aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/emulate.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2011-04-23 05:51:07 -0400
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:43 -0400
commitb96a7fad020b42eb4a564f8a2fb41827a83c4375 (patch)
tree381f8a65caa493256cace5cdb479dc5b9ab32aa5 /arch/x86/kvm/emulate.c
parentc54fe504693204fa672b10a57c3d82a8c41e0b4e (diff)
KVM: x86 emulator: Use opcode::execute for PUSHA/POPA (60/61)
For this, emulate_pusha/popa() are converted to em_pusha/popa(). Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r--arch/x86/kvm/emulate.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 9f491bfb00fd..b7c6e43e4f2b 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1473,7 +1473,7 @@ static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt,
1473 return rc; 1473 return rc;
1474} 1474}
1475 1475
1476static int emulate_pusha(struct x86_emulate_ctxt *ctxt) 1476static int em_pusha(struct x86_emulate_ctxt *ctxt)
1477{ 1477{
1478 struct decode_cache *c = &ctxt->decode; 1478 struct decode_cache *c = &ctxt->decode;
1479 unsigned long old_esp = c->regs[VCPU_REGS_RSP]; 1479 unsigned long old_esp = c->regs[VCPU_REGS_RSP];
@@ -1494,8 +1494,7 @@ static int emulate_pusha(struct x86_emulate_ctxt *ctxt)
1494 return rc; 1494 return rc;
1495} 1495}
1496 1496
1497static int emulate_popa(struct x86_emulate_ctxt *ctxt, 1497static int em_popa(struct x86_emulate_ctxt *ctxt)
1498 struct x86_emulate_ops *ops)
1499{ 1498{
1500 struct decode_cache *c = &ctxt->decode; 1499 struct decode_cache *c = &ctxt->decode;
1501 int rc = X86EMUL_CONTINUE; 1500 int rc = X86EMUL_CONTINUE;
@@ -1508,7 +1507,7 @@ static int emulate_popa(struct x86_emulate_ctxt *ctxt,
1508 --reg; 1507 --reg;
1509 } 1508 }
1510 1509
1511 rc = emulate_pop(ctxt, ops, &c->regs[reg], c->op_bytes); 1510 rc = emulate_pop(ctxt, ctxt->ops, &c->regs[reg], c->op_bytes);
1512 if (rc != X86EMUL_CONTINUE) 1511 if (rc != X86EMUL_CONTINUE)
1513 break; 1512 break;
1514 --reg; 1513 --reg;
@@ -3098,7 +3097,8 @@ static struct opcode opcode_table[256] = {
3098 /* 0x58 - 0x5F */ 3097 /* 0x58 - 0x5F */
3099 X8(I(DstReg | Stack, em_pop)), 3098 X8(I(DstReg | Stack, em_pop)),
3100 /* 0x60 - 0x67 */ 3099 /* 0x60 - 0x67 */
3101 D(ImplicitOps | Stack | No64), D(ImplicitOps | Stack | No64), 3100 I(ImplicitOps | Stack | No64, em_pusha),
3101 I(ImplicitOps | Stack | No64, em_popa),
3102 N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ , 3102 N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ ,
3103 N, N, N, N, 3103 N, N, N, N,
3104 /* 0x68 - 0x6F */ 3104 /* 0x68 - 0x6F */
@@ -3823,12 +3823,6 @@ special_insn:
3823 case 0x48 ... 0x4f: /* dec r16/r32 */ 3823 case 0x48 ... 0x4f: /* dec r16/r32 */
3824 emulate_1op("dec", c->dst, ctxt->eflags); 3824 emulate_1op("dec", c->dst, ctxt->eflags);
3825 break; 3825 break;
3826 case 0x60: /* pusha */
3827 rc = emulate_pusha(ctxt);
3828 break;
3829 case 0x61: /* popa */
3830 rc = emulate_popa(ctxt, ops);
3831 break;
3832 case 0x63: /* movsxd */ 3826 case 0x63: /* movsxd */
3833 if (ctxt->mode != X86EMUL_MODE_PROT64) 3827 if (ctxt->mode != X86EMUL_MODE_PROT64)
3834 goto cannot_emulate; 3828 goto cannot_emulate;