diff options
author | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2011-11-11 18:11:34 +0000 |
---|---|---|
committer | Andres Lagar-Cavilla <andres@lagarcavilla.org> | 2011-11-11 18:11:34 +0000 |
commit | 51032ca058e43fbd37ea1f7c7c003496f6451340 (patch) | |
tree | 179fda9e3eba652562ca7aa3e6139852cbe3ed23 /xen/arch/x86/traps.c | |
parent | e0594d9bc1c7996840f421a4084830d5a296e51b (diff) | |
download | xen-51032ca058e43fbd37ea1f7c7c003496f6451340.tar.gz xen-51032ca058e43fbd37ea1f7c7c003496f6451340.tar.bz2 xen-51032ca058e43fbd37ea1f7c7c003496f6451340.zip |
Modify naming of queries into the p2m
Callers of lookups into the p2m code are now variants of get_gfn. All
callers need to call put_gfn. The code behind it is a no-op at the
moment, but will change to proper locking in a later patch.
This patch does not change functionality. Only naming, and adds
put_gfn's.
set_p2m_entry retains its name because it is always called with
p2m_lock held.
This patch is humongous, unfortunately, given the dozens of call sites
involved.
After this patch, anyone using old style gfn_to_mfn will not succeed
in compiling their code. This is on purpose: adapt to the new API.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/traps.c')
-rw-r--r-- | xen/arch/x86/traps.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index a8bad8f7fc..d6e9c0ccb3 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -673,11 +673,12 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) return 0; } - mfn = gmfn_to_mfn(d, gmfn); + mfn = get_gfn_untyped(d, gmfn); if ( !mfn_valid(mfn) || !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) ) { + put_gfn(d, gmfn); gdprintk(XENLOG_WARNING, "Bad GMFN %lx (MFN %lx) to MSR %08x\n", gmfn, mfn, base + idx); @@ -689,6 +690,7 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val) unmap_domain_page(hypercall_page); put_page_and_type(mfn_to_page(mfn)); + put_gfn(d, gmfn); break; } @@ -2347,18 +2349,25 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) arch_set_cr2(v, *reg); break; - case 3: /* Write CR3 */ + case 3: {/* Write CR3 */ + unsigned long mfn, gfn; domain_lock(v->domain); if ( !is_pv_32on64_vcpu(v) ) - rc = new_guest_cr3(gmfn_to_mfn(v->domain, xen_cr3_to_pfn(*reg))); + { + gfn = xen_cr3_to_pfn(*reg); #ifdef CONFIG_COMPAT - else - rc = new_guest_cr3(gmfn_to_mfn(v->domain, compat_cr3_to_pfn(*reg))); + } else { + gfn = compat_cr3_to_pfn(*reg); #endif + } + mfn = get_gfn_untyped(v->domain, gfn); + rc = new_guest_cr3(mfn); + put_gfn(v->domain, gfn); domain_unlock(v->domain); if ( rc == 0 ) /* not okay */ goto fail; break; + } case 4: /* Write CR4 */ v->arch.pv_vcpu.ctrlreg[4] = pv_guest_cr4_fixup(v, *reg); |