Commit b13354f8 authored by Mohammed Gamal's avatar Mohammed Gamal Committed by Avi Kivity

KVM: x86 emulator: emulate nop and xchg reg, acc (opcodes 0x90 - 0x97)

Signed-off-by: default avatarMohammed Gamal <m.gamal005@gmail.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent f76c710d
...@@ -140,8 +140,9 @@ static u16 opcode_table[256] = { ...@@ -140,8 +140,9 @@ static u16 opcode_table[256] = {
ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
DstMem | SrcReg | ModRM | Mov, ModRM | DstReg, DstMem | SrcReg | ModRM | Mov, ModRM | DstReg,
DstReg | SrcMem | ModRM | Mov, Group | Group1A, DstReg | SrcMem | ModRM | Mov, Group | Group1A,
/* 0x90 - 0x9F */ /* 0x90 - 0x97 */
0, 0, 0, 0, 0, 0, 0, 0, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg,
/* 0x98 - 0x9F */
0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
/* 0xA0 - 0xA7 */ /* 0xA0 - 0xA7 */
ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs, ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs,
...@@ -1493,6 +1494,7 @@ special_insn: ...@@ -1493,6 +1494,7 @@ special_insn:
emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags); emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags);
break; break;
case 0x86 ... 0x87: /* xchg */ case 0x86 ... 0x87: /* xchg */
xchg:
/* Write back the register source. */ /* Write back the register source. */
switch (c->dst.bytes) { switch (c->dst.bytes) {
case 1: case 1:
...@@ -1560,6 +1562,17 @@ special_insn: ...@@ -1560,6 +1562,17 @@ special_insn:
if (rc != 0) if (rc != 0)
goto done; goto done;
break; break;
case 0x90: /* nop / xchg r8,rax */
if (!(c->rex_prefix & 1)) { /* nop */
c->dst.type = OP_NONE;
break;
}
case 0x91 ... 0x97: /* xchg reg,rax */
c->src.type = c->dst.type = OP_REG;
c->src.bytes = c->dst.bytes = c->op_bytes;
c->src.ptr = (unsigned long *) &c->regs[VCPU_REGS_RAX];
c->src.val = *(c->src.ptr);
goto xchg;
case 0x9c: /* pushf */ case 0x9c: /* pushf */
c->src.val = (unsigned long) ctxt->eflags; c->src.val = (unsigned long) ctxt->eflags;
emulate_push(ctxt); emulate_push(ctxt);
......
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