From 950f9d95bed1a366434d3597ea75f5b9d772d74f Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 30 Jan 2008 13:34:06 +0100 Subject: x86: fix the missing BIOS area check in page_is_ram page_is_ram has a FIXME since ages, which reminds to sanity check the BIOS area between 640k and 1M, which is sometimes falsely reported as RAM in the e820 tables. Implement the sanity check. Move the BIOS range defines from pageattr.c into e820.h to avoid duplicate defines. Signed-off-by: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/x86/mm/ioremap.c | 15 ++++++++++----- arch/x86/mm/pageattr.c | 7 +------ 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'arch/x86') diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index d3026e1906f..24e42cab8d5 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -42,13 +42,18 @@ int page_is_ram(unsigned long pagenr) */ if (e820.map[i].type != E820_RAM) continue; - /* - * !!!FIXME!!! Some BIOSen report areas as RAM that - * are not. Notably the 640->1Mb area. We need a sanity - * check here. - */ addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; + + /* + * Sanity check: Some BIOSen report areas as RAM that + * are not. Notably the 640->1Mb area, which is the + * PCI BIOS area. + */ + if (addr >= (BIOS_BEGIN >> PAGE_SHIFT) && + end < (BIOS_END >> PAGE_SHIFT)) + continue; + if ((pagenr >= addr) && (pagenr < end)) return 1; } diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 19f7f7a0b36..fcd96125c5a 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -9,18 +9,13 @@ #include #include +#include #include #include #include #include #include -/* - * We must allow the BIOS range to be executable: - */ -#define BIOS_BEGIN 0x000a0000 -#define BIOS_END 0x00100000 - static inline int within(unsigned long addr, unsigned long start, unsigned long end) { -- cgit v1.2.3