aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-03-17 19:37:08 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-24 17:57:31 -0400
commit430442e38e7f049841c5838f8c7027bd9e170045 (patch)
tree22d3fde2adafd9c3140af8559fc410a02a1775b8
parentabf33038ffa65097939d86d2a90f93adc6115aa0 (diff)
xen: make use of pte_t union
pte_t always contains a "pte" field for the whole pte value, so make use of it. 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>
-rw-r--r--arch/x86/xen/mmu.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 363f7a3b67fb..3148db8e794e 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -216,12 +216,10 @@ void xen_pmd_clear(pmd_t *pmdp)
216 216
217pteval_t xen_pte_val(pte_t pte) 217pteval_t xen_pte_val(pte_t pte)
218{ 218{
219 pteval_t ret = 0; 219 pteval_t ret = pte.pte;
220 220
221 if (pte.pte_low) { 221 if (ret & _PAGE_PRESENT)
222 ret = ((pteval_t)pte.pte_high << 32) | pte.pte_low; 222 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
223 ret = machine_to_phys(XMADDR(ret)).paddr | 1;
224 }
225 223
226 return ret; 224 return ret;
227} 225}
@@ -229,16 +227,16 @@ pteval_t xen_pte_val(pte_t pte)
229pmdval_t xen_pmd_val(pmd_t pmd) 227pmdval_t xen_pmd_val(pmd_t pmd)
230{ 228{
231 pmdval_t ret = pmd.pmd; 229 pmdval_t ret = pmd.pmd;
232 if (ret) 230 if (ret & _PAGE_PRESENT)
233 ret = machine_to_phys(XMADDR(ret)).paddr | 1; 231 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
234 return ret; 232 return ret;
235} 233}
236 234
237pgdval_t xen_pgd_val(pgd_t pgd) 235pgdval_t xen_pgd_val(pgd_t pgd)
238{ 236{
239 pgdval_t ret = pgd.pgd; 237 pgdval_t ret = pgd.pgd;
240 if (ret) 238 if (ret & _PAGE_PRESENT)
241 ret = machine_to_phys(XMADDR(ret)).paddr | 1; 239 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
242 return ret; 240 return ret;
243} 241}
244 242
@@ -254,7 +252,7 @@ pte_t xen_make_pte(pteval_t pte)
254 252
255pmd_t xen_make_pmd(pmdval_t pmd) 253pmd_t xen_make_pmd(pmdval_t pmd)
256{ 254{
257 if (pmd & 1) 255 if (pmd & _PAGE_PRESENT)
258 pmd = phys_to_machine(XPADDR(pmd)).maddr; 256 pmd = phys_to_machine(XPADDR(pmd)).maddr;
259 257
260 return (pmd_t){ pmd }; 258 return (pmd_t){ pmd };
@@ -275,7 +273,7 @@ void xen_set_pte(pte_t *ptep, pte_t pte)
275 273
276pteval_t xen_pte_val(pte_t pte) 274pteval_t xen_pte_val(pte_t pte)
277{ 275{
278 pteval_t ret = pte.pte_low; 276 pteval_t ret = pte.pte;
279 277
280 if (ret & _PAGE_PRESENT) 278 if (ret & _PAGE_PRESENT)
281 ret = machine_to_phys(XMADDR(ret)).paddr; 279 ret = machine_to_phys(XMADDR(ret)).paddr;
@@ -286,8 +284,8 @@ pteval_t xen_pte_val(pte_t pte)
286pgdval_t xen_pgd_val(pgd_t pgd) 284pgdval_t xen_pgd_val(pgd_t pgd)
287{ 285{
288 pteval_t ret = pgd.pgd; 286 pteval_t ret = pgd.pgd;
289 if (ret) 287 if (ret & _PAGE_PRESENT)
290 ret = machine_to_phys(XMADDR(ret)).paddr | 1; 288 ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
291 return ret; 289 return ret;
292} 290}
293 291