]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/asm-x86/page.h
x86: page.h: unify page copying and clearing
[linux-2.6-omap-h63xx.git] / include / asm-x86 / page.h
1 #ifndef _ASM_X86_PAGE_H
2 #define _ASM_X86_PAGE_H
3
4 #include <linux/const.h>
5
6 /* PAGE_SHIFT determines the page size */
7 #define PAGE_SHIFT      12
8 #define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
9 #define PAGE_MASK       (~(PAGE_SIZE-1))
10
11 #define PHYSICAL_PAGE_MASK      (PAGE_MASK & __PHYSICAL_MASK)
12
13 #define LARGE_PAGE_SIZE         (_AC(1,UL) << PMD_SHIFT)
14 #define LARGE_PAGE_MASK         (~(LARGE_PAGE_SIZE-1))
15
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)
20
21 /* to align the pointer to the (next) page boundary */
22 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
23
24 #define __PHYSICAL_MASK         ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
25 #define __VIRTUAL_MASK          ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
26
27
28 #ifdef CONFIG_X86_64
29 #define THREAD_ORDER    1
30 #define THREAD_SIZE  (PAGE_SIZE << THREAD_ORDER)
31 #define CURRENT_MASK (~(THREAD_SIZE-1))
32
33 #define EXCEPTION_STACK_ORDER 0
34 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
35
36 #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
37 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
38
39 #define IRQSTACK_ORDER 2
40 #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
41
42 #define STACKFAULT_STACK 1
43 #define DOUBLEFAULT_STACK 2
44 #define NMI_STACK 3
45 #define DEBUG_STACK 4
46 #define MCE_STACK 5
47 #define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
48
49 #define __PAGE_OFFSET           _AC(0xffff810000000000, UL)
50
51 #define __PHYSICAL_START        CONFIG_PHYSICAL_START
52 #define __KERNEL_ALIGN          0x200000
53
54 /*
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)
58  */
59 #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
60 #error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
61 #endif
62
63 #define __START_KERNEL          (__START_KERNEL_map + __PHYSICAL_START)
64 #define __START_KERNEL_map      _AC(0xffffffff80000000, UL)
65
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
69
70 #define KERNEL_TEXT_SIZE  (40*1024*1024)
71 #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
72
73 #ifndef __ASSEMBLY__
74 void clear_page(void *page);
75 void copy_page(void *to, void *from);
76 #endif  /* !__ASSEMBLY__ */
77
78 #endif  /* CONFIG_X86_64 */
79
80 #ifdef CONFIG_X86_32
81
82 /*
83  * This handles the memory map.
84  *
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.
88  *
89  * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
90  * and CONFIG_HIGHMEM64G options in the kernel configuration.
91  */
92 #define __PAGE_OFFSET           _AC(CONFIG_PAGE_OFFSET, UL)
93
94 #ifdef CONFIG_X86_PAE
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 */
101
102 #ifdef CONFIG_HUGETLB_PAGE
103 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
104 #endif
105
106 #ifndef __ASSEMBLY__
107 #ifdef CONFIG_X86_USE_3DNOW
108 #include <asm/mmx.h>
109
110 static inline void clear_page(void *page)
111 {
112         mmx_clear_page(page);
113 }
114
115 static inline void copy_page(void *to, void *from)
116 {
117         mmx_copy_page(to, from);
118 }
119 #else  /* !CONFIG_X86_USE_3DNOW */
120 #include <linux/string.h>
121
122 static inline void clear_page(void *page)
123 {
124         memset(page, 0, PAGE_SIZE);
125 }
126
127 static inline void copy_page(void *to, void *from)
128 {
129         memcpy(to, from, PAGE_SIZE);
130 }
131 #endif  /* CONFIG_X86_3DNOW */
132 #endif  /* !__ASSEMBLY__ */
133
134 #endif  /* CONFIG_X86_32 */
135
136 #define PAGE_OFFSET             ((unsigned long)__PAGE_OFFSET)
137
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)
141
142
143 #ifndef __ASSEMBLY__
144 struct page;
145
146 static void inline clear_user_page(void *page, unsigned long vaddr,
147                                 struct page *pg)
148 {
149         clear_page(page);
150 }
151
152 static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
153                                 struct page *topage)
154 {
155         copy_page(to, from);
156 }
157
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
161
162 #endif  /* __ASSEMBLY__ */
163
164
165 #ifdef CONFIG_X86_32
166 # include "page_32.h"
167 #else
168 # include "page_64.h"
169 #endif
170
171 #endif  /* _ASM_X86_PAGE_H */