page.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef _ASM_X86_PAGE_H
  2. #define _ASM_X86_PAGE_H
  3. #include <linux/types.h>
  4. #ifdef __KERNEL__
  5. #include <asm/page_types.h>
  6. #ifdef CONFIG_X86_64
  7. #include <asm/page_64.h>
  8. #else
  9. #include <asm/page_32.h>
  10. #endif /* CONFIG_X86_64 */
  11. #ifndef __ASSEMBLY__
  12. struct page;
  13. static inline void clear_user_page(void *page, unsigned long vaddr,
  14. struct page *pg)
  15. {
  16. clear_page(page);
  17. }
  18. static inline void copy_user_page(void *to, void *from, unsigned long vaddr,
  19. struct page *topage)
  20. {
  21. copy_page(to, from);
  22. }
  23. #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
  24. alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
  25. #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
  26. #define __pa(x) __phys_addr((unsigned long)(x))
  27. #define __pa_nodebug(x) __phys_addr_nodebug((unsigned long)(x))
  28. /* __pa_symbol should be used for C visible symbols.
  29. This seems to be the official gcc blessed way to do such arithmetic. */
  30. /*
  31. * We need __phys_reloc_hide() here because gcc may assume that there is no
  32. * overflow during __pa() calculation and can optimize it unexpectedly.
  33. * Newer versions of gcc provide -fno-strict-overflow switch to handle this
  34. * case properly. Once all supported versions of gcc understand it, we can
  35. * remove this Voodoo magic stuff. (i.e. once gcc3.x is deprecated)
  36. */
  37. #define __pa_symbol(x) __pa(__phys_reloc_hide((unsigned long)(x)))
  38. #define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
  39. #define __boot_va(x) __va(x)
  40. #define __boot_pa(x) __pa(x)
  41. /*
  42. * virt_to_page(kaddr) returns a valid pointer if and only if
  43. * virt_addr_valid(kaddr) returns true.
  44. */
  45. #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  46. #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
  47. extern bool __virt_addr_valid(unsigned long kaddr);
  48. #define virt_addr_valid(kaddr) __virt_addr_valid((unsigned long) (kaddr))
  49. #endif /* __ASSEMBLY__ */
  50. #include <asm-generic/memory_model.h>
  51. #include <asm-generic/getorder.h>
  52. #define __HAVE_ARCH_GATE_AREA 1
  53. #endif /* __KERNEL__ */
  54. #endif /* _ASM_X86_PAGE_H */