mirror of
https://github.com/torvalds/linux
synced 2024-09-26 22:38:50 +00:00
KVM: x86 emulator: convert INC/DEC to fastop
Reviewed-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi.kivity@gmail.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
9ae9febae9
commit
95413dc413
|
@ -2055,6 +2055,8 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
|
||||||
|
|
||||||
FASTOP1(not);
|
FASTOP1(not);
|
||||||
FASTOP1(neg);
|
FASTOP1(neg);
|
||||||
|
FASTOP1(inc);
|
||||||
|
FASTOP1(dec);
|
||||||
|
|
||||||
FASTOP2CL(rol);
|
FASTOP2CL(rol);
|
||||||
FASTOP2CL(ror);
|
FASTOP2CL(ror);
|
||||||
|
@ -2105,12 +2107,6 @@ static int em_grp45(struct x86_emulate_ctxt *ctxt)
|
||||||
int rc = X86EMUL_CONTINUE;
|
int rc = X86EMUL_CONTINUE;
|
||||||
|
|
||||||
switch (ctxt->modrm_reg) {
|
switch (ctxt->modrm_reg) {
|
||||||
case 0: /* inc */
|
|
||||||
emulate_1op(ctxt, "inc");
|
|
||||||
break;
|
|
||||||
case 1: /* dec */
|
|
||||||
emulate_1op(ctxt, "dec");
|
|
||||||
break;
|
|
||||||
case 2: /* call near abs */ {
|
case 2: /* call near abs */ {
|
||||||
long int old_eip;
|
long int old_eip;
|
||||||
old_eip = ctxt->_eip;
|
old_eip = ctxt->_eip;
|
||||||
|
@ -3735,14 +3731,14 @@ static const struct opcode group3[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct opcode group4[] = {
|
static const struct opcode group4[] = {
|
||||||
I(ByteOp | DstMem | SrcNone | Lock, em_grp45),
|
F(ByteOp | DstMem | SrcNone | Lock, em_inc),
|
||||||
I(ByteOp | DstMem | SrcNone | Lock, em_grp45),
|
F(ByteOp | DstMem | SrcNone | Lock, em_dec),
|
||||||
N, N, N, N, N, N,
|
N, N, N, N, N, N,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct opcode group5[] = {
|
static const struct opcode group5[] = {
|
||||||
I(DstMem | SrcNone | Lock, em_grp45),
|
F(DstMem | SrcNone | Lock, em_inc),
|
||||||
I(DstMem | SrcNone | Lock, em_grp45),
|
F(DstMem | SrcNone | Lock, em_dec),
|
||||||
I(SrcMem | Stack, em_grp45),
|
I(SrcMem | Stack, em_grp45),
|
||||||
I(SrcMemFAddr | ImplicitOps | Stack, em_call_far),
|
I(SrcMemFAddr | ImplicitOps | Stack, em_call_far),
|
||||||
I(SrcMem | Stack, em_grp45),
|
I(SrcMem | Stack, em_grp45),
|
||||||
|
@ -3891,7 +3887,7 @@ static const struct opcode opcode_table[256] = {
|
||||||
/* 0x38 - 0x3F */
|
/* 0x38 - 0x3F */
|
||||||
F6ALU(NoWrite, em_cmp), N, N,
|
F6ALU(NoWrite, em_cmp), N, N,
|
||||||
/* 0x40 - 0x4F */
|
/* 0x40 - 0x4F */
|
||||||
X16(D(DstReg)),
|
X8(F(DstReg, em_inc)), X8(F(DstReg, em_dec)),
|
||||||
/* 0x50 - 0x57 */
|
/* 0x50 - 0x57 */
|
||||||
X8(I(SrcReg | Stack, em_push)),
|
X8(I(SrcReg | Stack, em_push)),
|
||||||
/* 0x58 - 0x5F */
|
/* 0x58 - 0x5F */
|
||||||
|
@ -4681,12 +4677,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
|
||||||
goto twobyte_insn;
|
goto twobyte_insn;
|
||||||
|
|
||||||
switch (ctxt->b) {
|
switch (ctxt->b) {
|
||||||
case 0x40 ... 0x47: /* inc r16/r32 */
|
|
||||||
emulate_1op(ctxt, "inc");
|
|
||||||
break;
|
|
||||||
case 0x48 ... 0x4f: /* dec r16/r32 */
|
|
||||||
emulate_1op(ctxt, "dec");
|
|
||||||
break;
|
|
||||||
case 0x63: /* movsxd */
|
case 0x63: /* movsxd */
|
||||||
if (ctxt->mode != X86EMUL_MODE_PROT64)
|
if (ctxt->mode != X86EMUL_MODE_PROT64)
|
||||||
goto cannot_emulate;
|
goto cannot_emulate;
|
||||||
|
|
Loading…
Reference in a new issue