page_32.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. /* 44=32+12, the limit we can fit into an unsigned long pfn */
  16. #define __PHYSICAL_MASK_SHIFT 44
  17. #define __VIRTUAL_MASK_SHIFT 32
  18. #define PAGETABLE_LEVELS 3
  19. #ifndef __ASSEMBLY__
  20. typedef u64 pteval_t;
  21. typedef u64 pmdval_t;
  22. typedef u64 pudval_t;
  23. typedef u64 pgdval_t;
  24. typedef u64 pgprotval_t;
  25. typedef u64 phys_addr_t;
  26. typedef union {
  27. struct {
  28. unsigned long pte_low, pte_high;
  29. };
  30. pteval_t pte;
  31. } pte_t;
  32. #endif /* __ASSEMBLY__
  33. */
  34. #else /* !CONFIG_X86_PAE */
  35. #define __PHYSICAL_MASK_SHIFT 32
  36. #define __VIRTUAL_MASK_SHIFT 32
  37. #define PAGETABLE_LEVELS 2
  38. #ifndef __ASSEMBLY__
  39. typedef unsigned long pteval_t;
  40. typedef unsigned long pmdval_t;
  41. typedef unsigned long pudval_t;
  42. typedef unsigned long pgdval_t;
  43. typedef unsigned long pgprotval_t;
  44. typedef unsigned long phys_addr_t;
  45. typedef union {
  46. pteval_t pte;
  47. pteval_t pte_low;
  48. } pte_t;
  49. #endif /* __ASSEMBLY__ */
  50. #endif /* CONFIG_X86_PAE */
  51. #ifndef __ASSEMBLY__
  52. typedef struct page *pgtable_t;
  53. #endif
  54. #ifdef CONFIG_HUGETLB_PAGE
  55. #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  56. #endif
  57. #ifndef __ASSEMBLY__
  58. #define __phys_addr(x) ((x) - PAGE_OFFSET)
  59. #define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
  60. #ifdef CONFIG_FLATMEM
  61. #define pfn_valid(pfn) ((pfn) < max_mapnr)
  62. #endif /* CONFIG_FLATMEM */
  63. extern int nx_enabled;
  64. /*
  65. * This much address space is reserved for vmalloc() and iomap()
  66. * as well as fixmap mappings.
  67. */
  68. extern unsigned int __VMALLOC_RESERVE;
  69. extern int sysctl_legacy_va_layout;
  70. #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
  71. #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE)
  72. #ifdef CONFIG_X86_USE_3DNOW
  73. #include <asm/mmx.h>
  74. static inline void clear_page(void *page)
  75. {
  76. mmx_clear_page(page);
  77. }
  78. static inline void copy_page(void *to, void *from)
  79. {
  80. mmx_copy_page(to, from);
  81. }
  82. #else /* !CONFIG_X86_USE_3DNOW */
  83. #include <linux/string.h>
  84. static inline void clear_page(void *page)
  85. {
  86. memset(page, 0, PAGE_SIZE);
  87. }
  88. static inline void copy_page(void *to, void *from)
  89. {
  90. memcpy(to, from, PAGE_SIZE);
  91. }
  92. #endif /* CONFIG_X86_3DNOW */
  93. #endif /* !__ASSEMBLY__ */
  94. #endif /* _ASM_X86_PAGE_32_H */