aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/kvm/x86_emulate.c
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2007-10-12 20:40:33 -0400
committerAvi Kivity <avi@qumranet.com>2008-01-30 10:52:53 -0500
commitd77a25074a8f845401f0eb786ebb8996e45d9e22 (patch)
tree54729328075c2b822ebbb9266b9a23d4eeefd92c /drivers/kvm/x86_emulate.c
parent3176bc3e59cc4e30ac10888f08124b31969a7a88 (diff)
KVM: x86 emulator: Implement emulation of instruction: inc & dec
Instructions: inc r16/r32 (opcode 0x40-0x47) dec r16/r32 (opcode 0x48-0x4f) Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/x86_emulate.c')
-rw-r--r--drivers/kvm/x86_emulate.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 75fd23bade9c..988c6498640f 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -96,8 +96,12 @@ static u8 opcode_table[256] = {
96 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 96 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
97 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 97 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
98 0, 0, 0, 0, 98 0, 0, 0, 0,
99 /* 0x40 - 0x4F */ 99 /* 0x40 - 0x47 */
100 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 100 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
101 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
102 /* 0x48 - 0x4F */
103 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
104 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
101 /* 0x50 - 0x57 */ 105 /* 0x50 - 0x57 */
102 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, 106 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
103 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, 107 ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1376,6 +1380,18 @@ special_insn:
1376 if (c->twobyte) 1380 if (c->twobyte)
1377 goto twobyte_special_insn; 1381 goto twobyte_special_insn;
1378 switch (c->b) { 1382 switch (c->b) {
1383 case 0x40 ... 0x47: /* inc r16/r32 */
1384 c->dst.bytes = c->op_bytes;
1385 c->dst.ptr = (unsigned long *)&c->regs[c->b & 0x7];
1386 c->dst.val = *c->dst.ptr;
1387 emulate_1op("inc", c->dst, ctxt->eflags);
1388 break;
1389 case 0x48 ... 0x4f: /* dec r16/r32 */
1390 c->dst.bytes = c->op_bytes;
1391 c->dst.ptr = (unsigned long *)&c->regs[c->b & 0x7];
1392 c->dst.val = *c->dst.ptr;
1393 emulate_1op("dec", c->dst, ctxt->eflags);
1394 break;
1379 case 0x50 ... 0x57: /* push reg */ 1395 case 0x50 ... 0x57: /* push reg */
1380 if (c->op_bytes == 2) 1396 if (c->op_bytes == 2)
1381 c->src.val = (u16) c->regs[c->b & 0x7]; 1397 c->src.val = (u16) c->regs[c->b & 0x7];