diff options
-rw-r--r-- | include/asm-x86/page.h | 72 | ||||
-rw-r--r-- | include/asm-x86/page_64.h | 21 |
2 files changed, 72 insertions, 21 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index 530439e0d340..014f087d7c27 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -181,6 +181,78 @@ static void inline copy_user_page(void *to, void *from, unsigned long vaddr, | |||
181 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | 181 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
182 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 182 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
183 | 183 | ||
184 | #ifdef CONFIG_X86_64 | ||
185 | typedef struct { pgdval_t pgd; } pgd_t; | ||
186 | typedef struct { pgprotval_t pgprot; } pgprot_t; | ||
187 | |||
188 | static inline pgd_t native_make_pgd(pgdval_t val) | ||
189 | { | ||
190 | return (pgd_t) { val }; | ||
191 | } | ||
192 | |||
193 | static inline pgdval_t native_pgd_val(pgd_t pgd) | ||
194 | { | ||
195 | return pgd.pgd; | ||
196 | } | ||
197 | |||
198 | #if PAGETABLE_LEVELS >= 3 | ||
199 | #if PAGETABLE_LEVELS == 4 | ||
200 | typedef struct { pudval_t pud; } pud_t; | ||
201 | |||
202 | static inline pud_t native_make_pud(pmdval_t val) | ||
203 | { | ||
204 | return (pud_t) { val }; | ||
205 | } | ||
206 | |||
207 | static inline pudval_t native_pud_val(pud_t pud) | ||
208 | { | ||
209 | return pud.pud; | ||
210 | } | ||
211 | #else /* PAGETABLE_LEVELS == 3 */ | ||
212 | #include <asm-generic/pgtable-nopud.h> | ||
213 | #endif /* PAGETABLE_LEVELS == 4 */ | ||
214 | |||
215 | typedef struct { pmdval_t pmd; } pmd_t; | ||
216 | |||
217 | static inline pmd_t native_make_pmd(pmdval_t val) | ||
218 | { | ||
219 | return (pmd_t) { val }; | ||
220 | } | ||
221 | |||
222 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
223 | { | ||
224 | return pmd.pmd; | ||
225 | } | ||
226 | #else /* PAGETABLE_LEVELS == 2 */ | ||
227 | #include <asm-generic/pgtable-nopmd.h> | ||
228 | #endif /* PAGETABLE_LEVELS >= 3 */ | ||
229 | |||
230 | #define pgprot_val(x) ((x).pgprot) | ||
231 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
232 | |||
233 | #ifdef CONFIG_PARAVIRT | ||
234 | #include <asm/paravirt.h> | ||
235 | #else /* !CONFIG_PARAVIRT */ | ||
236 | |||
237 | #define pgd_val(x) native_pgd_val(x) | ||
238 | #define __pgd(x) native_make_pgd(x) | ||
239 | |||
240 | #ifndef __PAGETABLE_PUD_FOLDED | ||
241 | #define pud_val(x) native_pud_val(x) | ||
242 | #define __pud(x) native_make_pud(x) | ||
243 | #endif | ||
244 | |||
245 | #ifndef __PAGETABLE_PMD_FOLDED | ||
246 | #define pmd_val(x) native_pmd_val(x) | ||
247 | #define __pmd(x) native_make_pmd(x) | ||
248 | #endif | ||
249 | |||
250 | #define pte_val(x) native_pte_val(x) | ||
251 | #define __pte(x) native_make_pte(x) | ||
252 | |||
253 | #endif /* CONFIG_PARAVIRT */ | ||
254 | |||
255 | #endif /* CONFIG_X86_64 */ | ||
184 | #endif /* __ASSEMBLY__ */ | 256 | #endif /* __ASSEMBLY__ */ |
185 | 257 | ||
186 | 258 | ||
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index f5e82c695d26..f8a07bf54c3c 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h | |||
@@ -7,30 +7,9 @@ | |||
7 | extern unsigned long end_pfn; | 7 | extern unsigned long end_pfn; |
8 | extern unsigned long end_pfn_map; | 8 | extern unsigned long end_pfn_map; |
9 | 9 | ||
10 | /* | ||
11 | * These are used to make use of C type-checking.. | ||
12 | */ | ||
13 | typedef struct { unsigned long pmd; } pmd_t; | ||
14 | typedef struct { unsigned long pud; } pud_t; | ||
15 | typedef struct { unsigned long pgd; } pgd_t; | ||
16 | #define PTE_MASK PHYSICAL_PAGE_MASK | ||
17 | |||
18 | typedef struct { unsigned long pgprot; } pgprot_t; | ||
19 | 10 | ||
20 | extern unsigned long phys_base; | 11 | extern unsigned long phys_base; |
21 | 12 | ||
22 | #define pte_val(x) ((x).pte) | ||
23 | #define pmd_val(x) ((x).pmd) | ||
24 | #define pud_val(x) ((x).pud) | ||
25 | #define pgd_val(x) ((x).pgd) | ||
26 | #define pgprot_val(x) ((x).pgprot) | ||
27 | |||
28 | #define __pte(x) ((pte_t) { (x) } ) | ||
29 | #define __pmd(x) ((pmd_t) { (x) } ) | ||
30 | #define __pud(x) ((pud_t) { (x) } ) | ||
31 | #define __pgd(x) ((pgd_t) { (x) } ) | ||
32 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
33 | |||
34 | #endif /* !__ASSEMBLY__ */ | 13 | #endif /* !__ASSEMBLY__ */ |
35 | 14 | ||
36 | #ifndef __ASSEMBLY__ | 15 | #ifndef __ASSEMBLY__ |