|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v5 37/45] x86/shadow: use map_domain_pages() for cross-page emulated writes
sh_emulate_map_dest() picks its mapping method purely on whether the
write straddles a page boundary: a single page goes through
map_domain_page(), two pages through vmap() -- mapping the destination
in every context for the duration, those of domains on the sparse
directmap view included, whatever the guest's own configuration.
map_domain_pages() maps it only in the page tables of the guest's own
domain; use it for the two-page case.
The NULL return handling is unchanged: the primitive can fail only for
want of a free slot, and the emulation then bails out as unhandleable
exactly as before.
This is one of the two in-tree consumers of the primitive.
Assisted-by: Claude Code:claude-fable-5, Claude Code:claude-opus-5-5
Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
Changes in v5:
- New in this version.
---
xen/arch/x86/mm/shadow/hvm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/mm/shadow/hvm.c b/xen/arch/x86/mm/shadow/hvm.c
index 0b23326214..b1c3d5e637 100644
--- a/xen/arch/x86/mm/shadow/hvm.c
+++ b/xen/arch/x86/mm/shadow/hvm.c
@@ -506,7 +506,7 @@ static void *sh_emulate_map_dest(struct vcpu *v, unsigned
long vaddr,
/* Cross-page writes mean probably not a pagetable. */
sh_remove_shadows(d, sh_ctxt->mfn[1], 0, 0 /* Slow, can fail. */ );
- map = vmap(sh_ctxt->mfn, 2);
+ map = map_domain_pages(sh_ctxt->mfn, 2);
if ( !map )
{
put_page(mfn_to_page(sh_ctxt->mfn[0]));
@@ -670,7 +670,7 @@ static void sh_emulate_unmap_dest(struct vcpu *v, void
*addr,
if ( unlikely(mfn_valid(sh_ctxt->mfn[1])) )
{
put_page(mfn_to_page(sh_ctxt->mfn[1]));
- vunmap((void *)((unsigned long)addr & PAGE_MASK));
+ unmap_domain_pages(addr, 2);
}
else
unmap_domain_page(addr);
--
2.56.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |