page_64.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _ASM_X86_PAGE_64_H
  2. #define _ASM_X86_PAGE_64_H
  3. #include <asm/page_64_types.h>
  4. #ifndef __ASSEMBLY__
  5. #include <asm/alternative.h>
  6. /* duplicated to the one in bootmem.h */
  7. extern unsigned long max_pfn;
  8. extern unsigned long phys_base;
  9. static inline unsigned long __phys_addr_nodebug(unsigned long x)
  10. {
  11. unsigned long y = x - __START_KERNEL_map;
  12. /* use the carry flag to determine if x was < __START_KERNEL_map */
  13. x = y + ((x > y) ? phys_base : (__START_KERNEL_map - PAGE_OFFSET));
  14. return x;
  15. }
  16. #ifdef CONFIG_DEBUG_VIRTUAL
  17. extern unsigned long __phys_addr(unsigned long);
  18. extern unsigned long __phys_addr_symbol(unsigned long);
  19. #else
  20. #define __phys_addr(x) __phys_addr_nodebug(x)
  21. #define __phys_addr_symbol(x) \
  22. ((unsigned long)(x) - __START_KERNEL_map + phys_base)
  23. #endif
  24. #define __phys_reloc_hide(x) (x)
  25. #ifdef CONFIG_FLATMEM
  26. #define pfn_valid(pfn) ((pfn) < max_pfn)
  27. #endif
  28. void clear_page_orig(void *page);
  29. void clear_page_rep(void *page);
  30. void clear_page_erms(void *page);
  31. static inline void clear_page(void *page)
  32. {
  33. alternative_call_2(clear_page_orig,
  34. clear_page_rep, X86_FEATURE_REP_GOOD,
  35. clear_page_erms, X86_FEATURE_ERMS,
  36. "=D" (page),
  37. "0" (page)
  38. : "memory", "rax", "rcx");
  39. }
  40. void copy_page(void *to, void *from);
  41. #endif /* !__ASSEMBLY__ */
  42. #ifdef CONFIG_X86_VSYSCALL_EMULATION
  43. # define __HAVE_ARCH_GATE_AREA 1
  44. #endif
  45. #endif /* _ASM_X86_PAGE_64_H */