Skip to contentSkip to conversation

x86emulate - fix unintended writeback on cmp/test instructions

PATCH New Trolle Selander 1 participant 1 message Jul 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86emulate - fix unintended writeback on cmp/test instructions

This patch fixes an issue when x86_emulate is called with force_writeback=1 set. It resulted in cmp and test instructions with memory operands to have the mem value written back after instruction emulation finished. This caused false alarms on writes to RO mem, and might have caused other issues if unintended writes occured to device registers in mmio space.

<mailto:[email protected]> <[email protected]>

xen/arch/x86/x86_emulate/x86_emulate.c +2 -0
diff -uNr xen-unstable.hg-orig/xen/arch/x86/x86_emulate/x86_emulate.c xen-unstable.hg-fixcmp/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1606,6 +1606,7 @@
         dst.val = _regs.eax;
     case 0x38 ... 0x3b: cmp: /* cmp */
         emulate_2op_SrcV("cmp", src, dst, _regs.eflags);
+        dst.type = OP_NONE;
         break;
 
     case 0x62: /* bound */ {
@@ -1707,6 +1708,7 @@
         dst.val = _regs.eax;
     case 0x84 ... 0x85: test: /* test */
         emulate_2op_SrcV("test", src, dst, _regs.eflags);
+        dst.type = OP_NONE;
         break;
 
     case 0x86 ... 0x87: xchg: /* xchg */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel