Commit 430442e3 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar

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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent abf33038
...@@ -216,12 +216,10 @@ void xen_pmd_clear(pmd_t *pmdp) ...@@ -216,12 +216,10 @@ void xen_pmd_clear(pmd_t *pmdp)
pteval_t xen_pte_val(pte_t pte) pteval_t xen_pte_val(pte_t pte)
{ {
pteval_t ret = 0; pteval_t ret = pte.pte;
if (pte.pte_low) { if (ret & _PAGE_PRESENT)
ret = ((pteval_t)pte.pte_high << 32) | pte.pte_low; ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
ret = machine_to_phys(XMADDR(ret)).paddr | 1;
}
return ret; return ret;
} }
...@@ -229,16 +227,16 @@ pteval_t xen_pte_val(pte_t pte) ...@@ -229,16 +227,16 @@ pteval_t xen_pte_val(pte_t pte)
pmdval_t xen_pmd_val(pmd_t pmd) pmdval_t xen_pmd_val(pmd_t pmd)
{ {
pmdval_t ret = pmd.pmd; pmdval_t ret = pmd.pmd;
if (ret) if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | 1; ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
return ret; return ret;
} }
pgdval_t xen_pgd_val(pgd_t pgd) pgdval_t xen_pgd_val(pgd_t pgd)
{ {
pgdval_t ret = pgd.pgd; pgdval_t ret = pgd.pgd;
if (ret) if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | 1; ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
return ret; return ret;
} }
...@@ -254,7 +252,7 @@ pte_t xen_make_pte(pteval_t pte) ...@@ -254,7 +252,7 @@ pte_t xen_make_pte(pteval_t pte)
pmd_t xen_make_pmd(pmdval_t pmd) pmd_t xen_make_pmd(pmdval_t pmd)
{ {
if (pmd & 1) if (pmd & _PAGE_PRESENT)
pmd = phys_to_machine(XPADDR(pmd)).maddr; pmd = phys_to_machine(XPADDR(pmd)).maddr;
return (pmd_t){ pmd }; return (pmd_t){ pmd };
...@@ -275,7 +273,7 @@ void xen_set_pte(pte_t *ptep, pte_t pte) ...@@ -275,7 +273,7 @@ void xen_set_pte(pte_t *ptep, pte_t pte)
pteval_t xen_pte_val(pte_t pte) pteval_t xen_pte_val(pte_t pte)
{ {
pteval_t ret = pte.pte_low; pteval_t ret = pte.pte;
if (ret & _PAGE_PRESENT) if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr; ret = machine_to_phys(XMADDR(ret)).paddr;
...@@ -286,8 +284,8 @@ pteval_t xen_pte_val(pte_t pte) ...@@ -286,8 +284,8 @@ pteval_t xen_pte_val(pte_t pte)
pgdval_t xen_pgd_val(pgd_t pgd) pgdval_t xen_pgd_val(pgd_t pgd)
{ {
pteval_t ret = pgd.pgd; pteval_t ret = pgd.pgd;
if (ret) if (ret & _PAGE_PRESENT)
ret = machine_to_phys(XMADDR(ret)).paddr | 1; ret = machine_to_phys(XMADDR(ret)).paddr | _PAGE_PRESENT;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment