11965aae3SH. Peter Anvin #ifndef _ASM_X86_PAGE_64_H 21965aae3SH. Peter Anvin #define _ASM_X86_PAGE_64_H 3bb898558SAl Viro 451c78eb3SJeremy Fitzhardinge #include <asm/page_64_types.h> 5bb898558SAl Viro 6fb50b020SAlexander Duyck #ifndef __ASSEMBLY__ 7*f25d3847SBorislav Petkov #include <asm/alternative.h> 8fb50b020SAlexander Duyck 9fb50b020SAlexander Duyck /* duplicated to the one in bootmem.h */ 10fb50b020SAlexander Duyck extern unsigned long max_pfn; 11fb50b020SAlexander Duyck extern unsigned long phys_base; 12fb50b020SAlexander Duyck 130bdf525fSAlexander Duyck static inline unsigned long __phys_addr_nodebug(unsigned long x) 140bdf525fSAlexander Duyck { 150bdf525fSAlexander Duyck unsigned long y = x - __START_KERNEL_map; 160bdf525fSAlexander Duyck 170bdf525fSAlexander Duyck /* use the carry flag to determine if x was < __START_KERNEL_map */ 180bdf525fSAlexander Duyck x = y + ((x > y) ? phys_base : (__START_KERNEL_map - PAGE_OFFSET)); 190bdf525fSAlexander Duyck 200bdf525fSAlexander Duyck return x; 210bdf525fSAlexander Duyck } 220bdf525fSAlexander Duyck 230bdf525fSAlexander Duyck #ifdef CONFIG_DEBUG_VIRTUAL 24fb50b020SAlexander Duyck extern unsigned long __phys_addr(unsigned long); 257d74275dSAlexander Duyck extern unsigned long __phys_addr_symbol(unsigned long); 260bdf525fSAlexander Duyck #else 270bdf525fSAlexander Duyck #define __phys_addr(x) __phys_addr_nodebug(x) 287d74275dSAlexander Duyck #define __phys_addr_symbol(x) \ 297d74275dSAlexander Duyck ((unsigned long)(x) - __START_KERNEL_map + phys_base) 300bdf525fSAlexander Duyck #endif 31fb50b020SAlexander Duyck 32fb50b020SAlexander Duyck #define __phys_reloc_hide(x) (x) 33fb50b020SAlexander Duyck 34fb50b020SAlexander Duyck #ifdef CONFIG_FLATMEM 35fb50b020SAlexander Duyck #define pfn_valid(pfn) ((pfn) < max_pfn) 36fb50b020SAlexander Duyck #endif 37fb50b020SAlexander Duyck 38*f25d3847SBorislav Petkov void clear_page_orig(void *page); 39*f25d3847SBorislav Petkov void clear_page_rep(void *page); 40*f25d3847SBorislav Petkov void clear_page_erms(void *page); 41*f25d3847SBorislav Petkov 42*f25d3847SBorislav Petkov static inline void clear_page(void *page) 43*f25d3847SBorislav Petkov { 44*f25d3847SBorislav Petkov alternative_call_2(clear_page_orig, 45*f25d3847SBorislav Petkov clear_page_rep, X86_FEATURE_REP_GOOD, 46*f25d3847SBorislav Petkov clear_page_erms, X86_FEATURE_ERMS, 47*f25d3847SBorislav Petkov "=D" (page), 48*f25d3847SBorislav Petkov "0" (page) 49*f25d3847SBorislav Petkov : "memory", "rax", "rcx"); 50*f25d3847SBorislav Petkov } 51*f25d3847SBorislav Petkov 52fb50b020SAlexander Duyck void copy_page(void *to, void *from); 53fb50b020SAlexander Duyck 54fb50b020SAlexander Duyck #endif /* !__ASSEMBLY__ */ 55fb50b020SAlexander Duyck 561ad83c85SAndy Lutomirski #ifdef CONFIG_X86_VSYSCALL_EMULATION 57a6c19dfeSAndy Lutomirski # define __HAVE_ARCH_GATE_AREA 1 581ad83c85SAndy Lutomirski #endif 59a6c19dfeSAndy Lutomirski 601965aae3SH. Peter Anvin #endif /* _ASM_X86_PAGE_64_H */ 61