]> git.karo-electronics.de Git - mv-sheeva.git/blob - include/asm-x86/page.h
x86: page.h: move and unify types for pagetable entry, #3
[mv-sheeva.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 #define PTE_MASK                PHYSICAL_PAGE_MASK
13
14 #define LARGE_PAGE_SIZE         (_AC(1,UL) << PMD_SHIFT)
15 #define LARGE_PAGE_MASK         (~(LARGE_PAGE_SIZE-1))
16
17 #define HPAGE_SHIFT             PMD_SHIFT
18 #define HPAGE_SIZE              (_AC(1,UL) << HPAGE_SHIFT)
19 #define HPAGE_MASK              (~(HPAGE_SIZE - 1))
20 #define HUGETLB_PAGE_ORDER      (HPAGE_SHIFT - PAGE_SHIFT)
21
22 /* to align the pointer to the (next) page boundary */
23 #define PAGE_ALIGN(addr)        (((addr)+PAGE_SIZE-1)&PAGE_MASK)
24
25 #define __PHYSICAL_MASK         ((_AC(1,UL) << __PHYSICAL_MASK_SHIFT) - 1)
26 #define __VIRTUAL_MASK          ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)
27
28 #ifndef __ASSEMBLY__
29 #include <linux/types.h>
30 #endif
31
32 #ifdef CONFIG_X86_64
33 #define PAGETABLE_LEVELS        4
34
35 #define THREAD_ORDER    1
36 #define THREAD_SIZE  (PAGE_SIZE << THREAD_ORDER)
37 #define CURRENT_MASK (~(THREAD_SIZE-1))
38
39 #define EXCEPTION_STACK_ORDER 0
40 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
41
42 #define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
43 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
44
45 #define IRQSTACK_ORDER 2
46 #define IRQSTACKSIZE (PAGE_SIZE << IRQSTACK_ORDER)
47
48 #define STACKFAULT_STACK 1
49 #define DOUBLEFAULT_STACK 2
50 #define NMI_STACK 3
51 #define DEBUG_STACK 4
52 #define MCE_STACK 5
53 #define N_EXCEPTION_STACKS 5  /* hw limit: 7 */
54
55 #define __PAGE_OFFSET           _AC(0xffff810000000000, UL)
56
57 #define __PHYSICAL_START        CONFIG_PHYSICAL_START
58 #define __KERNEL_ALIGN          0x200000
59
60 /*
61  * Make sure kernel is aligned to 2MB address. Catching it at compile
62  * time is better. Change your config file and compile the kernel
63  * for a 2MB aligned address (CONFIG_PHYSICAL_START)
64  */
65 #if (CONFIG_PHYSICAL_START % __KERNEL_ALIGN) != 0
66 #error "CONFIG_PHYSICAL_START must be a multiple of 2MB"
67 #endif
68
69 #define __START_KERNEL          (__START_KERNEL_map + __PHYSICAL_START)
70 #define __START_KERNEL_map      _AC(0xffffffff80000000, UL)
71
72 /* See Documentation/x86_64/mm.txt for a description of the memory map. */
73 #define __PHYSICAL_MASK_SHIFT   46
74 #define __VIRTUAL_MASK_SHIFT    48
75
76 #define KERNEL_TEXT_SIZE  (40*1024*1024)
77 #define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)
78
79 #ifndef __ASSEMBLY__
80 void clear_page(void *page);
81 void copy_page(void *to, void *from);
82
83 /*
84  * These are used to make use of C type-checking..
85  */
86 typedef unsigned long   pteval_t;
87 typedef unsigned long   pmdval_t;
88 typedef unsigned long   pudval_t;
89 typedef unsigned long   pgdval_t;
90 typedef unsigned long   pgprotval_t;
91 typedef unsigned long   phys_addr_t;
92
93 typedef struct { pteval_t pte; } pte_t;
94
95 #endif  /* !__ASSEMBLY__ */
96
97 #endif  /* CONFIG_X86_64 */
98
99 #ifdef CONFIG_X86_32
100
101 /*
102  * This handles the memory map.
103  *
104  * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
105  * a virtual address space of one gigabyte, which limits the
106  * amount of physical memory you can use to about 950MB.
107  *
108  * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
109  * and CONFIG_HIGHMEM64G options in the kernel configuration.
110  */
111 #define __PAGE_OFFSET           _AC(CONFIG_PAGE_OFFSET, UL)
112
113 #ifdef CONFIG_X86_PAE
114 #define __PHYSICAL_MASK_SHIFT   36
115 #define __VIRTUAL_MASK_SHIFT    32
116 #else  /* !CONFIG_X86_PAE */
117 #define __PHYSICAL_MASK_SHIFT   32
118 #define __VIRTUAL_MASK_SHIFT    32
119 #endif  /* CONFIG_X86_PAE */
120
121 #ifdef CONFIG_HUGETLB_PAGE
122 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
123 #endif
124
125 #ifndef __ASSEMBLY__
126 #ifdef CONFIG_X86_USE_3DNOW
127 #include <asm/mmx.h>
128
129 static inline void clear_page(void *page)
130 {
131         mmx_clear_page(page);
132 }
133
134 static inline void copy_page(void *to, void *from)
135 {
136         mmx_copy_page(to, from);
137 }
138 #else  /* !CONFIG_X86_USE_3DNOW */
139 #include <linux/string.h>
140
141 static inline void clear_page(void *page)
142 {
143         memset(page, 0, PAGE_SIZE);
144 }
145
146 static inline void copy_page(void *to, void *from)
147 {
148         memcpy(to, from, PAGE_SIZE);
149 }
150 #endif  /* CONFIG_X86_3DNOW */
151 #endif  /* !__ASSEMBLY__ */
152
153 #endif  /* CONFIG_X86_32 */
154
155 #define PAGE_OFFSET             ((unsigned long)__PAGE_OFFSET)
156
157 #define VM_DATA_DEFAULT_FLAGS \
158         (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
159          VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
160
161
162 #ifndef __ASSEMBLY__
163 struct page;
164
165 static void inline clear_user_page(void *page, unsigned long vaddr,
166                                 struct page *pg)
167 {
168         clear_page(page);
169 }
170
171 static void inline copy_user_page(void *to, void *from, unsigned long vaddr,
172                                 struct page *topage)
173 {
174         copy_page(to, from);
175 }
176
177 #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
178         alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
179 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
180
181 #endif  /* __ASSEMBLY__ */
182
183
184 #ifdef CONFIG_X86_32
185 # include "page_32.h"
186 #else
187 # include "page_64.h"
188 #endif
189
190 #endif  /* _ASM_X86_PAGE_H */