Commit ebda02c2 authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Avi Kivity

KVM: x86 emulator: Use opcode::execute for RET(C3)

Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent e4f973ae
...@@ -1816,6 +1816,16 @@ static int em_grp9(struct x86_emulate_ctxt *ctxt) ...@@ -1816,6 +1816,16 @@ static int em_grp9(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE; return X86EMUL_CONTINUE;
} }
static int em_ret(struct x86_emulate_ctxt *ctxt)
{
struct decode_cache *c = &ctxt->decode;
c->dst.type = OP_REG;
c->dst.addr.reg = &c->eip;
c->dst.bytes = c->op_bytes;
return em_pop(ctxt);
}
static int em_ret_far(struct x86_emulate_ctxt *ctxt) static int em_ret_far(struct x86_emulate_ctxt *ctxt)
{ {
struct decode_cache *c = &ctxt->decode; struct decode_cache *c = &ctxt->decode;
...@@ -3188,7 +3198,7 @@ static struct opcode opcode_table[256] = { ...@@ -3188,7 +3198,7 @@ static struct opcode opcode_table[256] = {
/* 0xC0 - 0xC7 */ /* 0xC0 - 0xC7 */
D2bv(DstMem | SrcImmByte | ModRM), D2bv(DstMem | SrcImmByte | ModRM),
I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm), I(ImplicitOps | Stack | SrcImmU16, em_ret_near_imm),
D(ImplicitOps | Stack), I(ImplicitOps | Stack, em_ret),
D(DstReg | SrcMemFAddr | ModRM | No64), D(DstReg | SrcMemFAddr | ModRM | No64), D(DstReg | SrcMemFAddr | ModRM | No64), D(DstReg | SrcMemFAddr | ModRM | No64),
G(ByteOp, group11), G(0, group11), G(ByteOp, group11), G(0, group11),
/* 0xC8 - 0xCF */ /* 0xC8 - 0xCF */
...@@ -3943,12 +3953,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ...@@ -3943,12 +3953,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
case 0xc0 ... 0xc1: case 0xc0 ... 0xc1:
rc = em_grp2(ctxt); rc = em_grp2(ctxt);
break; break;
case 0xc3: /* ret */
c->dst.type = OP_REG;
c->dst.addr.reg = &c->eip;
c->dst.bytes = c->op_bytes;
rc = em_pop(ctxt);
break;
case 0xc4: /* les */ case 0xc4: /* les */
rc = emulate_load_segment(ctxt, VCPU_SREG_ES); rc = emulate_load_segment(ctxt, VCPU_SREG_ES);
break; break;
......
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