diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-01-30 07:32:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:32:43 -0500 |
commit | 881d90d0daaeac018b0d5beb739dd825ccee0143 (patch) | |
tree | c2b2b24032d503938110d83e7d143bf2b980b455 /include/asm-x86/page.h | |
parent | 38f0f12793a490ac633dbba2418172b7abfa077e (diff) |
x86: page.h: move and unify types for pagetable entry
# HG changeset patch
# User Jeremy Fitzhardinge <jeremy@xensource.com>
# Date 1199319654 28800
# Node ID 3bd7db6e85e66e7f3362874802df26a82fcb2d92
# Parent f7e7db3facd9406545103164f9be8f9ba1a2b549
x86: page.h: move and unify types for pagetable entry definitions
This patch:
1. Defines arch-specific types for the contents of a pagetable entry.
That is, 32-bit entries for 32-bit non-PAE, and 64-bit entries for
32-bit PAE and 64-bit. However, even though the latter two are the
same size, they're defined with different types in order to retain
compatibility with printk format strings, etc.
2. Defines arch-specific pte_t. This is different because 32-bit PAE
defines it in two halves, whereas 32-bit PAE and 64-bit define it as a
single entry. All the other pagetable levels can be defined in a
common way. This also defines arch-specific pte_val/make_pte functions.
3. Define PAGETABLE_LEVELS for each architecture variation, for later use.
4. Define common pagetable entry accessors in a paravirt-compatible
way. (64-bit does not yet use paravirt-ops in any way).
5. Convert a few instances of using a *_val() as an lvalue where it is
no longer a macro. There are still places in the 64-bit code which
use pte_val() as an lvalue.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
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 | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/include/asm-x86/page.h b/include/asm-x86/page.h index 014f087d7c27..00353eb5666d 100644 --- a/include/asm-x86/page.h +++ b/include/asm-x86/page.h | |||
@@ -116,9 +116,57 @@ typedef struct { pteval_t pte; } pte_t; | |||
116 | #ifdef CONFIG_X86_PAE | 116 | #ifdef CONFIG_X86_PAE |
117 | #define __PHYSICAL_MASK_SHIFT 36 | 117 | #define __PHYSICAL_MASK_SHIFT 36 |
118 | #define __VIRTUAL_MASK_SHIFT 32 | 118 | #define __VIRTUAL_MASK_SHIFT 32 |
119 | #define PAGETABLE_LEVELS 3 | ||
120 | |||
121 | #ifndef __ASSEMBLY__ | ||
122 | typedef u64 pteval_t; | ||
123 | typedef u64 pmdval_t; | ||
124 | typedef u64 pudval_t; | ||
125 | typedef u64 pgdval_t; | ||
126 | typedef u64 pgprotval_t; | ||
127 | typedef u64 phys_addr_t; | ||
128 | |||
129 | typedef struct { unsigned long pte_low, pte_high; } pte_t; | ||
130 | |||
131 | static inline unsigned long long native_pte_val(pte_t pte) | ||
132 | { | ||
133 | return pte.pte_low | ((unsigned long long)pte.pte_high << 32); | ||
134 | } | ||
135 | |||
136 | static inline pte_t native_make_pte(unsigned long long val) | ||
137 | { | ||
138 | return (pte_t) { .pte_low = val, .pte_high = (val >> 32) } ; | ||
139 | } | ||
140 | |||
141 | #endif /* __ASSEMBLY__ | ||
142 | */ | ||
119 | #else /* !CONFIG_X86_PAE */ | 143 | #else /* !CONFIG_X86_PAE */ |
120 | #define __PHYSICAL_MASK_SHIFT 32 | 144 | #define __PHYSICAL_MASK_SHIFT 32 |
121 | #define __VIRTUAL_MASK_SHIFT 32 | 145 | #define __VIRTUAL_MASK_SHIFT 32 |
146 | #define PAGETABLE_LEVELS 2 | ||
147 | |||
148 | #ifndef __ASSEMBLY__ | ||
149 | typedef unsigned long pteval_t; | ||
150 | typedef unsigned long pmdval_t; | ||
151 | typedef unsigned long pudval_t; | ||
152 | typedef unsigned long pgdval_t; | ||
153 | typedef unsigned long pgprotval_t; | ||
154 | typedef unsigned long phys_addr_t; | ||
155 | |||
156 | typedef struct { pteval_t pte_low; } pte_t; | ||
157 | typedef pte_t boot_pte_t; | ||
158 | |||
159 | static inline unsigned long native_pte_val(pte_t pte) | ||
160 | { | ||
161 | return pte.pte_low; | ||
162 | } | ||
163 | |||
164 | static inline pte_t native_make_pte(unsigned long val) | ||
165 | { | ||
166 | return (pte_t) { .pte_low = val }; | ||
167 | } | ||
168 | |||
169 | #endif /* __ASSEMBLY__ */ | ||
122 | #endif /* CONFIG_X86_PAE */ | 170 | #endif /* CONFIG_X86_PAE */ |
123 | 171 | ||
124 | #ifdef CONFIG_HUGETLB_PAGE | 172 | #ifdef CONFIG_HUGETLB_PAGE |
@@ -181,7 +229,6 @@ static void inline copy_user_page(void *to, void *from, unsigned long vaddr, | |||
181 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | 229 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
182 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 230 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
183 | 231 | ||
184 | #ifdef CONFIG_X86_64 | ||
185 | typedef struct { pgdval_t pgd; } pgd_t; | 232 | typedef struct { pgdval_t pgd; } pgd_t; |
186 | typedef struct { pgprotval_t pgprot; } pgprot_t; | 233 | typedef struct { pgprotval_t pgprot; } pgprot_t; |
187 | 234 | ||
@@ -252,7 +299,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd) | |||
252 | 299 | ||
253 | #endif /* CONFIG_PARAVIRT */ | 300 | #endif /* CONFIG_PARAVIRT */ |
254 | 301 | ||
255 | #endif /* CONFIG_X86_64 */ | ||
256 | #endif /* __ASSEMBLY__ */ | 302 | #endif /* __ASSEMBLY__ */ |
257 | 303 | ||
258 | 304 | ||