Commit befadafe authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Ben Hutchings

KVM: x86 emulator: Use opcode::execute for CALL

commit d4ddafcd upstream.

CALL: E8
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 3f09b1f1
...@@ -2536,6 +2536,15 @@ static int em_das(struct x86_emulate_ctxt *ctxt) ...@@ -2536,6 +2536,15 @@ static int em_das(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE; return X86EMUL_CONTINUE;
} }
static int em_call(struct x86_emulate_ctxt *ctxt)
{
long rel = ctxt->src.val;
ctxt->src.val = (unsigned long)ctxt->_eip;
jmp_rel(ctxt, rel);
return em_push(ctxt);
}
static int em_call_far(struct x86_emulate_ctxt *ctxt) static int em_call_far(struct x86_emulate_ctxt *ctxt)
{ {
u16 sel, old_cs; u16 sel, old_cs;
...@@ -3271,7 +3280,7 @@ static struct opcode opcode_table[256] = { ...@@ -3271,7 +3280,7 @@ static struct opcode opcode_table[256] = {
D2bvIP(SrcImmUByte | DstAcc, in, check_perm_in), D2bvIP(SrcImmUByte | DstAcc, in, check_perm_in),
D2bvIP(SrcAcc | DstImmUByte, out, check_perm_out), D2bvIP(SrcAcc | DstImmUByte, out, check_perm_out),
/* 0xE8 - 0xEF */ /* 0xE8 - 0xEF */
D(SrcImm | Stack), D(SrcImm | ImplicitOps), I(SrcImm | Stack, em_call), D(SrcImm | ImplicitOps),
I(SrcImmFAddr | No64, em_jmp_far), D(SrcImmByte | ImplicitOps), I(SrcImmFAddr | No64, em_jmp_far), D(SrcImmByte | ImplicitOps),
D2bvIP(SrcDX | DstAcc, in, check_perm_in), D2bvIP(SrcDX | DstAcc, in, check_perm_in),
D2bvIP(SrcAcc | DstDX, out, check_perm_out), D2bvIP(SrcAcc | DstDX, out, check_perm_out),
...@@ -3966,13 +3975,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ...@@ -3966,13 +3975,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
case 0xe6: /* outb */ case 0xe6: /* outb */
case 0xe7: /* out */ case 0xe7: /* out */
goto do_io_out; goto do_io_out;
case 0xe8: /* call (near) */ {
long int rel = ctxt->src.val;
ctxt->src.val = (unsigned long) ctxt->_eip;
jmp_rel(ctxt, rel);
rc = em_push(ctxt);
break;
}
case 0xe9: /* jmp rel */ case 0xe9: /* jmp rel */
case 0xeb: /* jmp rel short */ case 0xeb: /* jmp rel short */
jmp_rel(ctxt, ctxt->src.val); jmp_rel(ctxt, ctxt->src.val);
......
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