diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:34:06 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:06 -0500 |
commit | 5f5192b9feeff6a96c97c143c3ca558fdbe2dc8e (patch) | |
tree | 4abe5cf23d4cb4a052af8c26c80451b368392ee8 | |
parent | e1271f686a0e376aa6ee97984c16f91a787e4480 (diff) |
x86: move page_is_ram() function
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | arch/x86/mm/init_32.c | 22 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 24 | ||||
-rw-r--r-- | include/asm-x86/page.h | 3 | ||||
-rw-r--r-- | include/asm-x86/page_32.h | 1 |
4 files changed, 27 insertions, 23 deletions
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 7c9bb3076b8a..f7b941c3b2c3 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -211,28 +211,6 @@ static inline int page_kills_ppro(unsigned long pagenr) | |||
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
213 | 213 | ||
214 | int page_is_ram(unsigned long pagenr) | ||
215 | { | ||
216 | int i; | ||
217 | unsigned long addr, end; | ||
218 | |||
219 | for (i = 0; i < e820.nr_map; i++) { | ||
220 | |||
221 | if (e820.map[i].type != E820_RAM) /* not usable memory */ | ||
222 | continue; | ||
223 | /* | ||
224 | * !!!FIXME!!! Some BIOSen report areas as RAM that | ||
225 | * are not. Notably the 640->1Mb area. We need a sanity | ||
226 | * check here. | ||
227 | */ | ||
228 | addr = (e820.map[i].addr+PAGE_SIZE-1) >> PAGE_SHIFT; | ||
229 | end = (e820.map[i].addr+e820.map[i].size) >> PAGE_SHIFT; | ||
230 | if ((pagenr >= addr) && (pagenr < end)) | ||
231 | return 1; | ||
232 | } | ||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | #ifdef CONFIG_HIGHMEM | 214 | #ifdef CONFIG_HIGHMEM |
237 | pte_t *kmap_pte; | 215 | pte_t *kmap_pte; |
238 | pgprot_t kmap_prot; | 216 | pgprot_t kmap_prot; |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index f4a2082568c8..d3026e1906f9 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -31,6 +31,30 @@ EXPORT_SYMBOL(__phys_addr); | |||
31 | 31 | ||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | int page_is_ram(unsigned long pagenr) | ||
35 | { | ||
36 | unsigned long addr, end; | ||
37 | int i; | ||
38 | |||
39 | for (i = 0; i < e820.nr_map; i++) { | ||
40 | /* | ||
41 | * Not usable memory: | ||
42 | */ | ||
43 | if (e820.map[i].type != E820_RAM) | ||
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; | ||
51 | end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; | ||
52 | if ((pagenr >= addr) && (pagenr < end)) | ||
53 | return 1; | ||
54 | } | ||
55 | return 0; | ||
56 | } | ||
57 | |||
34 | /* | 58 | /* |
35 | * Fix up the linear direct mapping of the kernel to avoid cache attribute | 59 | * Fix up the linear direct mapping of the kernel to avoid cache attribute |
36 | * conflicts. | 60 | * conflicts. |
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index e2c79d8dcdcf..c8b30efeed85 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -47,6 +47,9 @@ | |||
47 | 47 | ||
48 | 48 | ||
49 | #ifndef __ASSEMBLY__ | 49 | #ifndef __ASSEMBLY__ |
50 | |||
51 | extern int page_is_ram(unsigned long pagenr); | ||
52 | |||
50 | struct page; | 53 | struct page; |
51 | 54 | ||
52 | static void inline clear_user_page(void *page, unsigned long vaddr, | 55 | static void inline clear_user_page(void *page, unsigned long vaddr, |
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h index 11c4b39cada1..a6fd10f230d2 100644 --- a/include/asm-x86/page_32.h +++ b/include/asm-x86/page_32.h | |||
@@ -73,7 +73,6 @@ extern int nx_enabled; | |||
73 | */ | 73 | */ |
74 | extern unsigned int __VMALLOC_RESERVE; | 74 | extern unsigned int __VMALLOC_RESERVE; |
75 | extern int sysctl_legacy_va_layout; | 75 | extern int sysctl_legacy_va_layout; |
76 | extern int page_is_ram(unsigned long pagenr); | ||
77 | 76 | ||
78 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) | 77 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) |
79 | #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) | 78 | #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) |