Commit 154832bf authored by Nadav Amit's avatar Nadav Amit Committed by Jiri Slaby

KVM: x86: Getting rid of grp45 in emulator

commit f7784046 upstream.

Breaking grp45 to the relevant functions to speed up the emulation and simplify
the code. In addition, it is necassary the next patch will distinguish between
far and near branches according to the flags.
Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 74b0a4b9
...@@ -1998,31 +1998,22 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt) ...@@ -1998,31 +1998,22 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
return rc; return rc;
} }
static int em_grp45(struct x86_emulate_ctxt *ctxt) static int em_jmp_abs(struct x86_emulate_ctxt *ctxt)
{ {
int rc = X86EMUL_CONTINUE; return assign_eip_near(ctxt, ctxt->src.val);
}
switch (ctxt->modrm_reg) { static int em_call_near_abs(struct x86_emulate_ctxt *ctxt)
case 2: /* call near abs */ { {
int rc;
long int old_eip; long int old_eip;
old_eip = ctxt->_eip; old_eip = ctxt->_eip;
rc = assign_eip_near(ctxt, ctxt->src.val); rc = assign_eip_near(ctxt, ctxt->src.val);
if (rc != X86EMUL_CONTINUE) if (rc != X86EMUL_CONTINUE)
break; return rc;
ctxt->src.val = old_eip; ctxt->src.val = old_eip;
rc = em_push(ctxt); rc = em_push(ctxt);
break;
}
case 4: /* jmp abs */
rc = assign_eip_near(ctxt, ctxt->src.val);
break;
case 5: /* jmp far */
rc = em_jmp_far(ctxt);
break;
case 6: /* push */
rc = em_push(ctxt);
break;
}
return rc; return rc;
} }
...@@ -3655,11 +3646,11 @@ static const struct opcode group4[] = { ...@@ -3655,11 +3646,11 @@ static const struct opcode group4[] = {
static const struct opcode group5[] = { static const struct opcode group5[] = {
F(DstMem | SrcNone | Lock, em_inc), F(DstMem | SrcNone | Lock, em_inc),
F(DstMem | SrcNone | Lock, em_dec), F(DstMem | SrcNone | Lock, em_dec),
I(SrcMem | Stack, em_grp45), I(SrcMem | Stack, em_call_near_abs),
I(SrcMemFAddr | ImplicitOps | Stack, em_call_far), I(SrcMemFAddr | ImplicitOps | Stack, em_call_far),
I(SrcMem | Stack, em_grp45), I(SrcMem | Stack, em_jmp_abs),
I(SrcMemFAddr | ImplicitOps, em_grp45), I(SrcMemFAddr | ImplicitOps, em_jmp_far),
I(SrcMem | Stack, em_grp45), D(Undefined), I(SrcMem | Stack, em_push), D(Undefined),
}; };
static const struct opcode group6[] = { static const struct opcode group6[] = {
......
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