page_32.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef _ASM_X86_PAGE_32_H
  2. #define _ASM_X86_PAGE_32_H
  3. /*
  4. * This handles the memory map.
  5. *
  6. * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
  7. * a virtual address space of one gigabyte, which limits the
  8. * amount of physical memory you can use to about 950MB.
  9. *
  10. * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
  11. * and CONFIG_HIGHMEM64G options in the kernel configuration.
  12. */
  13. #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
  14. #ifdef CONFIG_X86_PAE
  15. #define __PHYSICAL_MASK_SHIFT 36
  16. #define __VIRTUAL_MASK_SHIFT 32
  17. #define PAGETABLE_LEVELS 3
  18. #ifndef __ASSEMBLY__
  19. typedef u64 pteval_t;
  20. typedef u64 pmdval_t;
  21. typedef u64 pudval_t;
  22. typedef u64 pgdval_t;
  23. typedef u64 pgprotval_t;
  24. typedef u64 phys_addr_t;
  25. typedef union {
  26. struct {
  27. unsigned long pte_low, pte_high;
  28. };
  29. pteval_t pte;
  30. } pte_t;
  31. #endif /* __ASSEMBLY__
  32. */
  33. #else /* !CONFIG_X86_PAE */
  34. #define __PHYSICAL_MASK_SHIFT 32
  35. #define __VIRTUAL_MASK_SHIFT 32
  36. #define PAGETABLE_LEVELS 2
  37. #ifndef __ASSEMBLY__
  38. typedef unsigned long pteval_t;
  39. typedef unsigned long pmdval_t;
  40. typedef unsigned long pudval_t;
  41. typedef unsigned long pgdval_t;
  42. typedef unsigned long pgprotval_t;
  43. typedef unsigned long phys_addr_t;
  44. typedef union {
  45. pteval_t pte;
  46. pteval_t pte_low;
  47. } pte_t;
  48. #endif /* __ASSEMBLY__ */
  49. #endif /* CONFIG_X86_PAE */
  50. #ifndef __ASSEMBLY__
  51. typedef struct page *pgtable_t;
  52. #endif
  53. #ifdef CONFIG_HUGETLB_PAGE
  54. #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  55. #endif
  56. #ifndef __ASSEMBLY__
  57. #define __phys_addr(x) ((x) - PAGE_OFFSET)
  58. #define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
  59. #ifdef CONFIG_FLATMEM
  60. #define pfn_valid(pfn) ((pfn) < max_mapnr)
  61. #endif /* CONFIG_FLATMEM */
  62. extern int nx_enabled;
  63. /*
  64. * This much address space is reserved for vmalloc() and iomap()
  65. * as well as fixmap mappings.
  66. */
  67. extern unsigned int __VMALLOC_RESERVE;
  68. extern int sysctl_legacy_va_layout;
  69. #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
  70. #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
  71. #ifdef CONFIG_X86_USE_3DNOW
  72. #include <asm/mmx.h>
  73. static inline void clear_page(void *page)
  74. {
  75. mmx_clear_page(page);
  76. }
  77. static inline void copy_page(void *to, void *from)
  78. {
  79. mmx_copy_page(to, from);
  80. }
  81. #else /* !CONFIG_X86_USE_3DNOW */
  82. #include <linux/string.h>
  83. static inline void clear_page(void *page)
  84. {
  85. memset(page, 0, PAGE_SIZE);
  86. }
  87. static inline void copy_page(void *to, void *from)
  88. {
  89. memcpy(to, from, PAGE_SIZE);
  90. }
  91. #endif /* CONFIG_X86_3DNOW */
  92. #endif /* !__ASSEMBLY__ */
  93. #endif /* _ASM_X86_PAGE_32_H */