From: Takuya Yoshikawa Date: Tue, 12 Apr 2011 15:24:55 +0000 (+0900) Subject: KVM: x86 emulator: Disable writeback for CMP emulation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=575e7c1417d41dd72ddf2a49965f833ce9352e92;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git KVM: x86 emulator: Disable writeback for CMP emulation This stops "CMP r/m, reg" to write back the data into memory. Pointed out by Avi. The writeback suppression now covers CMP, CMPS, SCAS. Signed-off-by: Takuya Yoshikawa Signed-off-by: Avi Kivity --- diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 2ec69bc85846..1e0e3f8156f8 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -3671,6 +3671,7 @@ special_insn: break; case 0x38 ... 0x3d: cmp: /* cmp */ + c->dst.type = OP_NONE; /* Disable writeback. */ emulate_2op_SrcV("cmp", c->src, c->dst, ctxt->eflags); break; case 0x40 ... 0x47: /* inc r16/r32 */ @@ -3797,7 +3798,6 @@ special_insn: rc = emulate_popf(ctxt, ops, &c->dst.val, c->op_bytes); break; case 0xa6 ... 0xa7: /* cmps */ - c->dst.type = OP_NONE; /* Disable writeback. */ goto cmp; case 0xa8 ... 0xa9: /* test ax, imm */ goto test;