page_32.h 3.0 KB

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