diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:43 -0500 |
commit | 38f0f12793a490ac633dbba2418172b7abfa077e (patch) | |
tree | 864c90488c0f5afa49debf7f7ddadf0eacbbc653 /include/asm-x86/page.h | |
parent | d6e3cf63e927310f65e21132f1d1c50e3aa4c2b0 (diff) |
x86: page.h: move and unify types for pagetable entry, #5
based on:
Subject: x86: page.h: move and unify types for pagetable entry
From: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/asm-x86/page.h')
-rw-r--r-- | include/asm-x86/page.h | 72 |
1 files changed, 72 insertions, 0 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 | ||