WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86 hvm: Emulate RAM-to-RAM REP MOVS copi

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 hvm: Emulate RAM-to-RAM REP MOVS copies efficiently.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 27 Aug 2008 11:23:22 -0700
Delivery-date: Wed, 27 Aug 2008 11:23:13 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1219756217 -3600
# Node ID 493a0a87919e4403d88dc716254fbdf646afa2f1
# Parent  62b904dcf88c4549620741fcd16e9b33b53ea289
x86 hvm: Emulate RAM-to-RAM REP MOVS copies efficiently.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/hvm/emulate.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff -r 62b904dcf88c -r 493a0a87919e xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c        Tue Aug 26 13:00:43 2008 +0100
+++ b/xen/arch/x86/hvm/emulate.c        Tue Aug 26 14:10:17 2008 +0100
@@ -575,7 +575,8 @@ static int hvmemul_rep_movs(
     paddr_t sgpa, dgpa;
     uint32_t pfec = PFEC_page_present;
     p2m_type_t p2mt;
-    int rc;
+    int rc, df = !!(ctxt->regs->eflags & X86_EFLAGS_DF);
+    char *buf;
 
     rc = hvmemul_virtual_to_linear(
         src_seg, src_offset, bytes_per_rep, reps, hvm_access_read,
@@ -606,15 +607,29 @@ static int hvmemul_rep_movs(
     (void)gfn_to_mfn_current(sgpa >> PAGE_SHIFT, &p2mt);
     if ( !p2m_is_ram(p2mt) )
         return hvmemul_do_mmio(
-            sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ,
-            !!(ctxt->regs->eflags & X86_EFLAGS_DF), NULL);
+            sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ, df, NULL);
 
     (void)gfn_to_mfn_current(dgpa >> PAGE_SHIFT, &p2mt);
-    if ( p2m_is_ram(p2mt) )
+    if ( !p2m_is_ram(p2mt) )
+        return hvmemul_do_mmio(
+            dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
+
+    if ( df )
+    {
+        sgpa -= (*reps - 1) * bytes_per_rep;
+        dgpa -= (*reps - 1) * bytes_per_rep;
+    }
+
+    buf = xmalloc_bytes(*reps * bytes_per_rep);
+    if ( buf == NULL )
         return X86EMUL_UNHANDLEABLE;
-    return hvmemul_do_mmio(
-        dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE,
-        !!(ctxt->regs->eflags & X86_EFLAGS_DF), NULL);
+
+    hvm_copy_from_guest_phys(buf, sgpa, *reps * bytes_per_rep);
+    hvm_copy_to_guest_phys(dgpa, buf, *reps * bytes_per_rep);
+
+    xfree(buf);
+
+    return X86EMUL_OKAY;
 }
 
 static int hvmemul_read_segment(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 hvm: Emulate RAM-to-RAM REP MOVS copies efficiently., Xen patchbot-unstable <=