aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMohammed Gamal <m.gamal005@gmail.com>2008-06-15 12:37:38 -0400
committerAvi Kivity <avi@qumranet.com>2008-07-20 05:42:33 -0400
commitb13354f8f092884fa8d79472404de4907b25d579 (patch)
treebb3f5443ffcf98c8493a99bbbbc67c784bcc5901 /arch
parentf76c710d759250a43976bcfcab6af6ebb94b7dc2 (diff)
KVM: x86 emulator: emulate nop and xchg reg, acc (opcodes 0x90 - 0x97)
Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/x86_emulate.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
index b90857c76569..28082913919e 100644
--- a/arch/x86/kvm/x86_emulate.c
+++ b/arch/x86/kvm/x86_emulate.c
@@ -140,8 +140,9 @@ static u16 opcode_table[256] = {
140 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, 140 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
141 DstMem | SrcReg | ModRM | Mov, ModRM | DstReg, 141 DstMem | SrcReg | ModRM | Mov, ModRM | DstReg,
142 DstReg | SrcMem | ModRM | Mov, Group | Group1A, 142 DstReg | SrcMem | ModRM | Mov, Group | Group1A,
143 /* 0x90 - 0x9F */ 143 /* 0x90 - 0x97 */
144 0, 0, 0, 0, 0, 0, 0, 0, 144 DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg,
145 /* 0x98 - 0x9F */
145 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, 146 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
146 /* 0xA0 - 0xA7 */ 147 /* 0xA0 - 0xA7 */
147 ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs, 148 ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs,
@@ -1493,6 +1494,7 @@ special_insn:
1493 emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags); 1494 emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags);
1494 break; 1495 break;
1495 case 0x86 ... 0x87: /* xchg */ 1496 case 0x86 ... 0x87: /* xchg */
1497 xchg:
1496 /* Write back the register source. */ 1498 /* Write back the register source. */
1497 switch (c->dst.bytes) { 1499 switch (c->dst.bytes) {
1498 case 1: 1500 case 1:
@@ -1560,6 +1562,17 @@ special_insn:
1560 if (rc != 0) 1562 if (rc != 0)
1561 goto done; 1563 goto done;
1562 break; 1564 break;
1565 case 0x90: /* nop / xchg r8,rax */
1566 if (!(c->rex_prefix & 1)) { /* nop */
1567 c->dst.type = OP_NONE;
1568 break;
1569 }
1570 case 0x91 ... 0x97: /* xchg reg,rax */
1571 c->src.type = c->dst.type = OP_REG;
1572 c->src.bytes = c->dst.bytes = c->op_bytes;
1573 c->src.ptr = (unsigned long *) &c->regs[VCPU_REGS_RAX];
1574 c->src.val = *(c->src.ptr);
1575 goto xchg;
1563 case 0x9c: /* pushf */ 1576 case 0x9c: /* pushf */
1564 c->src.val = (unsigned long) ctxt->eflags; 1577 c->src.val = (unsigned long) ctxt->eflags;
1565 emulate_push(ctxt); 1578 emulate_push(ctxt);