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

[Xen-changelog] [xen-unstable] hvm: Fix a bug in the mmio emulation of SUB instruction.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1176719758 -3600
# Node ID a9aa7c29eda8a9abf11e761ed2b4beb0cbfd026d
# Parent  6a4c6d8a00f53ac22a2687e30d4ec6bfdd588cfe
hvm: Fix a bug in the mmio emulation of SUB instruction.
Signed-off-by: Dexuan Cui <dexuan.cui@xxxxxxxxx>
---
 tools/ioemu/target-i386-dm/helper2.c |   18 ++++++++++++++++++
 xen/arch/x86/hvm/platform.c          |    5 ++++-
 xen/include/public/hvm/ioreq.h       |    1 +
 3 files changed, 23 insertions(+), 1 deletion(-)

diff -r 6a4c6d8a00f5 -r a9aa7c29eda8 tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Sun Apr 15 21:56:38 2007 +0100
+++ b/tools/ioemu/target-i386-dm/helper2.c      Mon Apr 16 11:35:58 2007 +0100
@@ -408,6 +408,21 @@ void cpu_ioreq_add(CPUState *env, ioreq_
     req->data = tmp1;
 }
 
+void cpu_ioreq_sub(CPUState *env, ioreq_t *req)
+{
+    unsigned long tmp1, tmp2;
+
+    if (req->data_is_ptr != 0)
+        hw_error("expected scalar value");
+
+    read_physical(req->addr, req->size, &tmp1);
+    if (req->dir == IOREQ_WRITE) {
+        tmp2 = tmp1 - (unsigned long) req->data;
+        write_physical(req->addr, req->size, &tmp2);
+    }
+    req->data = tmp1;
+}
+
 void cpu_ioreq_or(CPUState *env, ioreq_t *req)
 {
     unsigned long tmp1, tmp2;
@@ -495,6 +510,9 @@ void __handle_ioreq(CPUState *env, ioreq
         break;
     case IOREQ_TYPE_ADD:
         cpu_ioreq_add(env, req);
+        break;
+    case IOREQ_TYPE_SUB:
+        cpu_ioreq_sub(env, req);
         break;
     case IOREQ_TYPE_OR:
         cpu_ioreq_or(env, req);
diff -r 6a4c6d8a00f5 -r a9aa7c29eda8 xen/arch/x86/hvm/platform.c
--- a/xen/arch/x86/hvm/platform.c       Sun Apr 15 21:56:38 2007 +0100
+++ b/xen/arch/x86/hvm/platform.c       Mon Apr 16 11:35:58 2007 +0100
@@ -1240,6 +1240,10 @@ void handle_mmio(unsigned long gpa)
         mmio_operands(IOREQ_TYPE_ADD, gpa, mmio_op, op_size);
         break;
 
+    case INSTR_SUB:
+        mmio_operands(IOREQ_TYPE_SUB, gpa, mmio_op, op_size);
+        break;
+
     case INSTR_XOR:
         mmio_operands(IOREQ_TYPE_XOR, gpa, mmio_op, op_size);
         break;
@@ -1261,7 +1265,6 @@ void handle_mmio(unsigned long gpa)
 
     case INSTR_CMP:        /* Pass through */
     case INSTR_TEST:
-    case INSTR_SUB:
         /* send the request and wait for the value */
         send_mmio_req(IOREQ_TYPE_COPY, gpa, 1, op_size, 0, IOREQ_READ, df, 0);
         break;
diff -r 6a4c6d8a00f5 -r a9aa7c29eda8 xen/include/public/hvm/ioreq.h
--- a/xen/include/public/hvm/ioreq.h    Sun Apr 15 21:56:38 2007 +0100
+++ b/xen/include/public/hvm/ioreq.h    Mon Apr 16 11:35:58 2007 +0100
@@ -41,6 +41,7 @@
 #define IOREQ_TYPE_ADD          6
 #define IOREQ_TYPE_TIMEOFFSET   7
 #define IOREQ_TYPE_INVALIDATE   8 /* mapcache */
+#define IOREQ_TYPE_SUB          9
 
 /*
  * VMExit dispatcher should cooperate with instruction decoder to

_______________________________________________
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®.