[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.2-testing] vmx realmode: Add REP MOVS handler.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1203343547 0
# Node ID 02e81731cf9cc9fc88a954599305cea54357d08b
# Parent  d590e594453015229747425753b4ef2ef0930b62
vmx realmode: Add REP MOVS handler.
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   16997:8e4cd0658c4152a02576892e895e63772bd9df1c
xen-unstable date:        Thu Feb 07 18:57:12 2008 +0000
---
 xen/arch/x86/hvm/vmx/realmode.c |   53 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+)

diff -r d590e5944530 -r 02e81731cf9c xen/arch/x86/hvm/vmx/realmode.c
--- a/xen/arch/x86/hvm/vmx/realmode.c   Mon Feb 18 14:05:24 2008 +0000
+++ b/xen/arch/x86/hvm/vmx/realmode.c   Mon Feb 18 14:05:47 2008 +0000
@@ -13,6 +13,7 @@
 #include <xen/init.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
+#include <xen/paging.h>
 #include <asm/event.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/support.h>
@@ -313,6 +314,57 @@ realmode_rep_outs(
     return X86EMUL_OKAY;
 }
 
+static int 
+realmode_rep_movs(
+   enum x86_segment src_seg,
+   unsigned long src_offset,
+   enum x86_segment dst_seg,
+   unsigned long dst_offset,
+   unsigned int bytes_per_rep,
+   unsigned long *reps,
+   struct x86_emulate_ctxt *ctxt)
+{
+    struct realmode_emulate_ctxt *rm_ctxt =
+        container_of(ctxt, struct realmode_emulate_ctxt, ctxt);
+    struct vcpu *curr = current;
+    uint32_t saddr = virtual_to_linear(src_seg, src_offset, rm_ctxt);
+    uint32_t daddr = virtual_to_linear(dst_seg, dst_offset, rm_ctxt);
+    p2m_type_t p2mt;
+
+    if ( (curr->arch.hvm_vcpu.guest_cr[0] & X86_CR0_PE) ||
+         curr->arch.hvm_vmx.real_mode_io_in_progress )
+        return X86EMUL_UNHANDLEABLE;
+
+    mfn_x(gfn_to_mfn_current(saddr >> PAGE_SHIFT, &p2mt));
+    if ( !p2m_is_ram(p2mt) )
+    {
+        if ( !curr->arch.hvm_vmx.real_mode_io_completed )
+        {
+            curr->arch.hvm_vmx.real_mode_io_in_progress = 1;
+            send_mmio_req(IOREQ_TYPE_COPY, saddr, *reps, bytes_per_rep,
+                      daddr, IOREQ_READ,
+                      !!(ctxt->regs->eflags & X86_EFLAGS_DF), 1);
+        }
+
+        if ( !curr->arch.hvm_vmx.real_mode_io_completed )
+            return X86EMUL_RETRY;
+
+        curr->arch.hvm_vmx.real_mode_io_completed = 0;
+    }
+    else
+    {
+        mfn_x(gfn_to_mfn_current(daddr >> PAGE_SHIFT, &p2mt));
+        if ( p2m_is_ram(p2mt) )
+            return X86EMUL_UNHANDLEABLE;
+        curr->arch.hvm_vmx.real_mode_io_in_progress = 1;
+        send_mmio_req(IOREQ_TYPE_COPY, daddr, *reps, bytes_per_rep,
+                      saddr, IOREQ_WRITE,
+                      !!(ctxt->regs->eflags & X86_EFLAGS_DF), 1);
+    }
+
+    return X86EMUL_OKAY;
+}
+
 static int
 realmode_read_segment(
     enum x86_segment seg,
@@ -600,6 +652,7 @@ static struct x86_emulate_ops realmode_e
     .cmpxchg       = realmode_emulate_cmpxchg,
     .rep_ins       = realmode_rep_ins,
     .rep_outs      = realmode_rep_outs,
+    .rep_movs      = realmode_rep_movs,
     .read_segment  = realmode_read_segment,
     .write_segment = realmode_write_segment,
     .read_io       = realmode_read_io,

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.