Commit 2a7c5b8b authored by Glauber Costa's avatar Glauber Costa Committed by Avi Kivity

KVM: x86 emulator: emulate clflush

If the guest issues a clflush in a mmio address, the instruction
can trap into the hypervisor. Currently, we do not decode clflush
properly, causing the guest to hang. This patch fixes this emulating
clflush (opcode 0f ae).
Signed-off-by: default avatarGlauber Costa <gcosta@redhat.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 376c53c2
...@@ -219,7 +219,7 @@ static u16 twobyte_table[256] = { ...@@ -219,7 +219,7 @@ static u16 twobyte_table[256] = {
/* 0xA0 - 0xA7 */ /* 0xA0 - 0xA7 */
0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0, 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0,
/* 0xA8 - 0xAF */ /* 0xA8 - 0xAF */
0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, 0, 0, 0, 0, 0, DstMem | SrcReg | ModRM | BitOp, 0, 0, ModRM, 0,
/* 0xB0 - 0xB7 */ /* 0xB0 - 0xB7 */
ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0, ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 0,
DstMem | SrcReg | ModRM | BitOp, DstMem | SrcReg | ModRM | BitOp,
...@@ -1947,6 +1947,8 @@ twobyte_insn: ...@@ -1947,6 +1947,8 @@ twobyte_insn:
c->src.val &= (c->dst.bytes << 3) - 1; c->src.val &= (c->dst.bytes << 3) - 1;
emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags); emulate_2op_SrcV_nobyte("bts", c->src, c->dst, ctxt->eflags);
break; break;
case 0xae: /* clflush */
break;
case 0xb0 ... 0xb1: /* cmpxchg */ case 0xb0 ... 0xb1: /* cmpxchg */
/* /*
* Save real source value, then compare EAX against * Save real source value, then compare EAX against
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment