page.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #ifndef _ASM_X86_PAGE_H
  2. #define _ASM_X86_PAGE_H
  3. #include <linux/const.h>
  4. /* PAGE_SHIFT determines the page size */
  5. #define PAGE_SHIFT 12
  6. #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
  7. #define PAGE_MASK (~(PAGE_SIZE-1))
  8. #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
  9. #define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
  10. #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
  11. #define HPAGE_SHIFT PMD_SHIFT
  12. #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
  13. #define HPAGE_MASK (~(HPAGE_SIZE - 1))
  14. #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
  15. /* to align the pointer to the (next) page boundary */
  16. #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  17. #define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
  18. #define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
  19. #ifdef CONFIG_X86_64
  20. #define THREAD_ORDER 1
  21. #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
  22. #define CURRENT_MASK (~(THREAD_SIZE-1))
  23. #define EXCEPTION_STACK_ORDER 0
  24. #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
  25. #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
  26. #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
  27. #define IRQSTACK_ORDER 2
  28. #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
  29. #define STACKFAULT_STACK 1
  30. #define DOUBLEFAULT_STACK 2
  31. #define NMI_STACK 3
  32. #define DEBUG_STACK 4
  33. #define MCE_STACK 5
  34. #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
  35. #define __PAGE_OFFSET _AC(0xffff810000000000, UL)
  36. #define __PHYSICAL_START CONFIG_PHYSICAL_START
  37. #define __KERNEL_ALIGN 0x200000
  38. /*
  39. * Make sure kernel is aligned to 2MB address. Catching it at compile
  40. * time is better. Change your config file and compile the kernel
  41. * for a 2MB aligned address (CONFIG_PHYSICAL_START)
  42. */
  43. #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
  44. #error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
  45. #endif
  46. #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
  47. #define __START_KERNEL_map _AC(0xffffffff80000000, UL)
  48. /* See Documentation/x86_64/mm.txt for a description of the memory map. */
  49. #define __PHYSICAL_MASK_SHIFT 46
  50. #define __VIRTUAL_MASK_SHIFT 48
  51. #define KERNEL_TEXT_SIZE (40*1024*1024)
  52. #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
  53. #endif /* CONFIG_X86_64 */
  54. #ifdef CONFIG_X86_32
  55. /*
  56. * This handles the memory map.
  57. *
  58. * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
  59. * a virtual address space of one gigabyte, which limits the
  60. * amount of physical memory you can use to about 950MB.
  61. *
  62. * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
  63. * and CONFIG_HIGHMEM64G options in the kernel configuration.
  64. */
  65. #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
  66. #ifdef CONFIG_X86_PAE
  67. #define __PHYSICAL_MASK_SHIFT 36
  68. #define __VIRTUAL_MASK_SHIFT 32
  69. #else /* !CONFIG_X86_PAE */
  70. #define __PHYSICAL_MASK_SHIFT 32
  71. #define __VIRTUAL_MASK_SHIFT 32
  72. #endif /* CONFIG_X86_PAE */
  73. #ifdef CONFIG_HUGETLB_PAGE
  74. #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
  75. #endif
  76. #endif /* CONFIG_X86_32 */
  77. #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
  78. #define VM_DATA_DEFAULT_FLAGS \
  79. (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
  80. VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  81. #ifdef CONFIG_X86_32
  82. # include "page_32.h"
  83. #else
  84. # include "page_64.h"
  85. #endif
  86. #endif /* _ASM_X86_PAGE_H */