Skip to content

Commit

Permalink
x86: move page_is_ram() function
Browse files Browse the repository at this point in the history
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Jan 30, 2008
1 parent e1271f6 commit 5f5192b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
22 changes: 0 additions & 22 deletions arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,28 +211,6 @@ static inline int page_kills_ppro(unsigned long pagenr)
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
pte_t *kmap_pte;
pgprot_t kmap_prot;
Expand Down
24 changes: 24 additions & 0 deletions arch/x86/mm/ioremap.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ EXPORT_SYMBOL(__phys_addr);

#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
* conflicts.
Expand Down
3 changes: 3 additions & 0 deletions include/asm-x86/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@


#ifndef __ASSEMBLY__

extern int page_is_ram(unsigned long pagenr);

struct page;

static void inline clear_user_page(void *page, unsigned long vaddr,
Expand Down
1 change: 0 additions & 1 deletion include/asm-x86/page_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ extern int nx_enabled;
*/
extern unsigned int __VMALLOC_RESERVE;
extern int sysctl_legacy_va_layout;
extern int page_is_ram(unsigned long pagenr);

#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
#define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
Expand Down

0 comments on commit 5f5192b

Please sign in to comment.