aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>2011-04-23 05:49:40 -0400
committerAvi Kivity <avi@redhat.com>2011-05-22 08:39:41 -0400
commitc54fe504693204fa672b10a57c3d82a8c41e0b4e (patch)
tree97289bcb5f7ade3afe22657d3c5c5042f9b784ce /arch
parentd67fc27ae2bdc2d2fb6c8ec4238a12b502b95cc7 (diff)
KVM: x86 emulator: Use opcode::execute for POP reg (58-5F)
In addition, the RET emulation is changed to call em_pop() to remove the pop_instruction label. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/emulate.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8784916abf7..9f491bfb00f 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1400,6 +1400,13 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt,
1400 return rc; 1400 return rc;
1401} 1401}
1402 1402
1403static int em_pop(struct x86_emulate_ctxt *ctxt)
1404{
1405 struct decode_cache *c = &ctxt->decode;
1406
1407 return emulate_pop(ctxt, ctxt->ops, &c->dst.val, c->op_bytes);
1408}
1409
1403static int emulate_popf(struct x86_emulate_ctxt *ctxt, 1410static int emulate_popf(struct x86_emulate_ctxt *ctxt,
1404 struct x86_emulate_ops *ops, 1411 struct x86_emulate_ops *ops,
1405 void *dest, int len) 1412 void *dest, int len)
@@ -3089,7 +3096,7 @@ static struct opcode opcode_table[256] = {
3089 /* 0x50 - 0x57 */ 3096 /* 0x50 - 0x57 */
3090 X8(I(SrcReg | Stack, em_push)), 3097 X8(I(SrcReg | Stack, em_push)),
3091 /* 0x58 - 0x5F */ 3098 /* 0x58 - 0x5F */
3092 X8(D(DstReg | Stack)), 3099 X8(I(DstReg | Stack, em_pop)),
3093 /* 0x60 - 0x67 */ 3100 /* 0x60 - 0x67 */
3094 D(ImplicitOps | Stack | No64), D(ImplicitOps | Stack | No64), 3101 D(ImplicitOps | Stack | No64), D(ImplicitOps | Stack | No64),
3095 N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ , 3102 N, D(DstReg | SrcMem32 | ModRM | Mov) /* movsxd (x86/64) */ ,
@@ -3816,10 +3823,6 @@ special_insn:
3816 case 0x48 ... 0x4f: /* dec r16/r32 */ 3823 case 0x48 ... 0x4f: /* dec r16/r32 */
3817 emulate_1op("dec", c->dst, ctxt->eflags); 3824 emulate_1op("dec", c->dst, ctxt->eflags);
3818 break; 3825 break;
3819 case 0x58 ... 0x5f: /* pop reg */
3820 pop_instruction:
3821 rc = emulate_pop(ctxt, ops, &c->dst.val, c->op_bytes);
3822 break;
3823 case 0x60: /* pusha */ 3826 case 0x60: /* pusha */
3824 rc = emulate_pusha(ctxt); 3827 rc = emulate_pusha(ctxt);
3825 break; 3828 break;
@@ -3922,7 +3925,8 @@ special_insn:
3922 c->dst.type = OP_REG; 3925 c->dst.type = OP_REG;
3923 c->dst.addr.reg = &c->eip; 3926 c->dst.addr.reg = &c->eip;
3924 c->dst.bytes = c->op_bytes; 3927 c->dst.bytes = c->op_bytes;
3925 goto pop_instruction; 3928 rc = em_pop(ctxt);
3929 break;
3926 case 0xc4: /* les */ 3930 case 0xc4: /* les */
3927 rc = emulate_load_segment(ctxt, ops, VCPU_SREG_ES); 3931 rc = emulate_load_segment(ctxt, ops, VCPU_SREG_ES);
3928 break; 3932 break;