page_32.h 2.4 KB

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