page_32.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 { pteval_t pte, pte_low; } pte_t;
  45. #endif /* __ASSEMBLY__ */
  46. #endif /* CONFIG_X86_PAE */
  47. #ifndef __ASSEMBLY__
  48. typedef struct page *pgtable_t;
  49. #endif
  50. #ifdef CONFIG_HUGETLB_PAGE
  51. #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  52. #endif
  53. #ifndef __ASSEMBLY__
  54. #define __phys_addr(x) ((x)-PAGE_OFFSET)
  55. #define __phys_reloc_hide(x) RELOC_HIDE((x), 0)
  56. #ifdef CONFIG_FLATMEM
  57. #define pfn_valid(pfn) ((pfn) < max_mapnr)
  58. #endif /* CONFIG_FLATMEM */
  59. extern int nx_enabled;
  60. /*
  61. * This much address space is reserved for vmalloc() and iomap()
  62. * as well as fixmap mappings.
  63. */
  64. extern unsigned int __VMALLOC_RESERVE;
  65. extern int sysctl_legacy_va_layout;
  66. #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
  67. #define MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
  68. #ifdef CONFIG_X86_USE_3DNOW
  69. #include <asm/mmx.h>
  70. static inline void clear_page(void *page)
  71. {
  72. mmx_clear_page(page);
  73. }
  74. static inline void copy_page(void *to, void *from)
  75. {
  76. mmx_copy_page(to, from);
  77. }
  78. #else /* !CONFIG_X86_USE_3DNOW */
  79. #include <linux/string.h>
  80. static inline void clear_page(void *page)
  81. {
  82. memset(page, 0, PAGE_SIZE);
  83. }
  84. static inline void copy_page(void *to, void *from)
  85. {
  86. memcpy(to, from, PAGE_SIZE);
  87. }
  88. #endif /* CONFIG_X86_3DNOW */
  89. #endif /* !__ASSEMBLY__ */
  90. #endif /* _ASM_X86_PAGE_32_H */