aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2008-01-30 07:34:06 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:06 -0500
commit950f9d95bed1a366434d3597ea75f5b9d772d74f (patch)
tree900c548d99c14aacc31888a3483545f8352aea22
parent5f5192b9feeff6a96c97c143c3ca558fdbe2dc8e (diff)
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 <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/mm/ioremap.c15
-rw-r--r--arch/x86/mm/pageattr.c7
-rw-r--r--include/asm-x86/e820.h3
3 files changed, 14 insertions, 11 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index d3026e1906f9..24e42cab8d58 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -42,13 +42,18 @@ int page_is_ram(unsigned long pagenr)
42 */ 42 */
43 if (e820.map[i].type != E820_RAM) 43 if (e820.map[i].type != E820_RAM)
44 continue; 44 continue;
45 /*
46 * !!!FIXME!!! Some BIOSen report areas as RAM that
47 * are not. Notably the 640->1Mb area. We need a sanity
48 * check here.
49 */
50 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; 45 addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT;
51 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; 46 end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT;
47
48 /*
49 * Sanity check: Some BIOSen report areas as RAM that
50 * are not. Notably the 640->1Mb area, which is the
51 * PCI BIOS area.
52 */
53 if (addr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
54 end < (BIOS_END >> PAGE_SHIFT))
55 continue;
56
52 if ((pagenr >= addr) && (pagenr < end)) 57 if ((pagenr >= addr) && (pagenr < end))
53 return 1; 58 return 1;
54 } 59 }
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 19f7f7a0b36f..fcd96125c5ae 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -9,18 +9,13 @@
9#include <linux/slab.h> 9#include <linux/slab.h>
10#include <linux/mm.h> 10#include <linux/mm.h>
11 11
12#include <asm/e820.h>
12#include <asm/processor.h> 13#include <asm/processor.h>
13#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
14#include <asm/sections.h> 15#include <asm/sections.h>
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
17 18
18/*
19 * We must allow the BIOS range to be executable:
20 */
21#define BIOS_BEGIN 0x000a0000
22#define BIOS_END 0x00100000
23
24static inline int 19static inline int
25within(unsigned long addr, unsigned long start, unsigned long end) 20within(unsigned long addr, unsigned long start, unsigned long end)
26{ 21{
diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h
index f96f1853bc41..7004251fc66b 100644
--- a/include/asm-x86/e820.h
+++ b/include/asm-x86/e820.h
@@ -25,6 +25,9 @@ struct e820map {
25#define ISA_START_ADDRESS 0xa0000 25#define ISA_START_ADDRESS 0xa0000
26#define ISA_END_ADDRESS 0x100000 26#define ISA_END_ADDRESS 0x100000
27 27
28#define BIOS_BEGIN 0x000a0000
29#define BIOS_END 0x00100000
30
28#ifdef __KERNEL__ 31#ifdef __KERNEL__
29#ifdef CONFIG_X86_32 32#ifdef CONFIG_X86_32
30# include "e820_32.h" 33# include "e820_32.h"