diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index ef393c3df902556dfd6d3aefd1ba4fadd6b53d10..9830eeb571733e2a9600a1dfce804ef663ea16ae 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h @@ -80,6 +80,9 @@ void clear_page(void *page); void copy_page(void *to, void *from); +extern unsigned long __phys_addr(unsigned long); +#define __phys_reloc_hide(x) (x) + /* * These are used to make use of C type-checking.. */ @@ -174,6 +177,13 @@ static inline pte_t native_make_pte(unsigned long val) #endif #ifndef __ASSEMBLY__ +#define __phys_addr(x) ((x)-PAGE_OFFSET) +#define __phys_reloc_hide(x) RELOC_HIDE((x), 0) + +#ifdef CONFIG_FLATMEM +#define pfn_valid(pfn) ((pfn) < max_mapnr) +#endif /* CONFIG_FLATMEM */ + #ifdef CONFIG_X86_USE_3DNOW #include @@ -299,6 +309,20 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) #endif /* CONFIG_PARAVIRT */ +#define __pa(x) __phys_addr((unsigned long)(x)) +/* __pa_symbol should be used for C visible symbols. + This seems to be the official gcc blessed way to do such arithmetic. */ +#define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x))) + +#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) + +#define __boot_va(x) __va(x) +#define __boot_pa(x) __pa(x) + +#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) +#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) + #endif /* __ASSEMBLY__ */ diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h index 2d60661ab34059e38a6275b5e63535ff5456800a..a27424a2ee0dde221aa4b04207ac921a7a1751bb 100644 --- a/include/asm-x86/page_32.h +++ b/include/asm-x86/page_32.h @@ -29,18 +29,7 @@ extern int page_is_ram(unsigned long pagenr); #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE) -#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) -/* __pa_symbol should be used for C visible symbols. - This seems to be the official gcc blessed way to do such arithmetic. */ -#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0)) -#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#ifdef CONFIG_FLATMEM -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#endif /* CONFIG_FLATMEM */ -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) - -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) + #include #include diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index f8a07bf54c3c28952b97f8f7c91631ee38769964..7094684270a683223c40501b5a41d3d960a2e45f 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h @@ -16,21 +16,8 @@ extern unsigned long phys_base; #include -extern unsigned long __phys_addr(unsigned long); - #endif /* __ASSEMBLY__ */ -#define __pa(x) __phys_addr((unsigned long)(x)) -#define __pa_symbol(x) __phys_addr((unsigned long)(x)) - -#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET)) -#define __boot_va(x) __va(x) -#define __boot_pa(x) __pa(x) - -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) -#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) - #define __HAVE_ARCH_GATE_AREA 1 #define vmemmap ((struct page *)VMEMMAP_START)