page_32.h 2.8 KB

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