Commit 5f5192b9 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar

x86: move page_is_ram() function

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent e1271f68
...@@ -211,28 +211,6 @@ static inline int page_kills_ppro(unsigned long pagenr) ...@@ -211,28 +211,6 @@ static inline int page_kills_ppro(unsigned long pagenr)
return 0; return 0;
} }
int page_is_ram(unsigned long pagenr)
{
int i;
unsigned long addr, end;
for (i = 0; i < e820.nr_map; i++) {
if (e820.map[i].type != E820_RAM) /* not usable memory */
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;
if ((pagenr >= addr) && (pagenr < end))
return 1;
}
return 0;
}
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
pte_t *kmap_pte; pte_t *kmap_pte;
pgprot_t kmap_prot; pgprot_t kmap_prot;
......
...@@ -31,6 +31,30 @@ EXPORT_SYMBOL(__phys_addr); ...@@ -31,6 +31,30 @@ EXPORT_SYMBOL(__phys_addr);
#endif #endif
int page_is_ram(unsigned long pagenr)
{
unsigned long addr, end;
int i;
for (i = 0; i < e820.nr_map; i++) {
/*
* Not usable memory:
*/
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;
if ((pagenr >= addr) && (pagenr < end))
return 1;
}
return 0;
}
/* /*
* Fix up the linear direct mapping of the kernel to avoid cache attribute * Fix up the linear direct mapping of the kernel to avoid cache attribute
* conflicts. * conflicts.
......
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
extern int page_is_ram(unsigned long pagenr);
struct page; struct page;
static void inline clear_user_page(void *page, unsigned long vaddr, static void inline clear_user_page(void *page, unsigned long vaddr,
......
...@@ -73,7 +73,6 @@ extern int nx_enabled; ...@@ -73,7 +73,6 @@ extern int nx_enabled;
*/ */
extern unsigned int __VMALLOC_RESERVE; extern unsigned int __VMALLOC_RESERVE;
extern int sysctl_legacy_va_layout; extern int sysctl_legacy_va_layout;
extern int page_is_ram(unsigned long pagenr);
#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment