1 #ifndef _ASM_X86_PAGE_H
2 #define _ASM_X86_PAGE_H
4 #include <linux/const.h>
6 /* PAGE_SHIFT determines the page size */
8 #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
9 #define PAGE_MASK (~(PAGE_SIZE-1))
11 #define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
13 #define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
14 #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
16 #define HPAGE_SHIFT PMD_SHIFT
17 #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
18 #define HPAGE_MASK (~(HPAGE_SIZE - 1))
19 #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
21 /* to align the pointer to the (next) page boundary */
22 #define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
24 #define __PHYSICAL_MASK ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
25 #define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
29 #define THREAD_ORDER 1
30 #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
31 #define CURRENT_MASK (~(THREAD_SIZE-1))
33 #define EXCEPTION_STACK_ORDER 0
34 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
36 #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
37 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
39 #define IRQSTACK_ORDER 2
40 #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
42 #define STACKFAULT_STACK 1
43 #define DOUBLEFAULT_STACK 2
47 #define N_EXCEPTION_STACKS 5 /* hw limit: 7 */
49 #define __PAGE_OFFSET _AC(0xffff810000000000, UL)
51 #define __PHYSICAL_START CONFIG_PHYSICAL_START
52 #define __KERNEL_ALIGN 0x200000
55 * Make sure kernel is aligned to 2MB address. Catching it at compile
56 * time is better. Change your config file and compile the kernel
57 * for a 2MB aligned address (CONFIG_PHYSICAL_START)
59 #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
60 #error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
63 #define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)
64 #define __START_KERNEL_map _AC(0xffffffff80000000, UL)
66 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
67 #define __PHYSICAL_MASK_SHIFT 46
68 #define __VIRTUAL_MASK_SHIFT 48
70 #define KERNEL_TEXT_SIZE (40*1024*1024)
71 #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
74 void clear_page(void *page);
75 void copy_page(void *to, void *from);
76 #endif /* !__ASSEMBLY__ */
78 #endif /* CONFIG_X86_64 */
83 * This handles the memory map.
85 * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
86 * a virtual address space of one gigabyte, which limits the
87 * amount of physical memory you can use to about 950MB.
89 * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
90 * and CONFIG_HIGHMEM64G options in the kernel configuration.
92 #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
95 #define __PHYSICAL_MASK_SHIFT 36
96 #define __VIRTUAL_MASK_SHIFT 32
97 #else /* !CONFIG_X86_PAE */
98 #define __PHYSICAL_MASK_SHIFT 32
99 #define __VIRTUAL_MASK_SHIFT 32
100 #endif /* CONFIG_X86_PAE */
102 #ifdef CONFIG_HUGETLB_PAGE
103 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
107 #ifdef CONFIG_X86_USE_3DNOW
110 static inline void clear_page(void *page)
112 mmx_clear_page(page);
115 static inline void copy_page(void *to, void *from)
117 mmx_copy_page(to, from);
119 #else /* !CONFIG_X86_USE_3DNOW */
120 #include <linux/string.h>
122 static inline void clear_page(void *page)
124 memset(page, 0, PAGE_SIZE);
127 static inline void copy_page(void *to, void *from)
129 memcpy(to, from, PAGE_SIZE);
131 #endif /* CONFIG_X86_3DNOW */
132 #endif /* !__ASSEMBLY__ */
134 #endif /* CONFIG_X86_32 */
136 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
138 #define VM_DATA_DEFAULT_FLAGS \
139 (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
140 VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
146 static void inline clear_user_page(void *page, unsigned long vaddr,
152 static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
158 #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
159 alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
160 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
162 #endif /* __ASSEMBLY__ */
166 # include "page_32.h"
168 # include "page_64.h"
171 #endif /* _ASM_X86_PAGE_H */