Skip to content

Commit 67e944a

Browse files
author
Peter Zijlstra
committed
KVM: x86: Introduce EM_ASM_2CL
Replace the FASTOP2CL instructions. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Sean Christopherson <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 975e517 commit 67e944a

1 file changed

Lines changed: 24 additions & 15 deletions

File tree

arch/x86/kvm/emulate.c

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ static int em_##op(struct x86_emulate_ctxt *ctxt) \
344344
ON64(case 8: __EM_ASM_2(op##q, rax, rdx); break;) \
345345
EM_ASM_END
346346

347+
/* 2-operand, using "a" (dst) and CL (src2) */
348+
#define EM_ASM_2CL(op) \
349+
EM_ASM_START(op) \
350+
case 1: __EM_ASM_2(op##b, al, cl); break; \
351+
case 2: __EM_ASM_2(op##w, ax, cl); break; \
352+
case 4: __EM_ASM_2(op##l, eax, cl); break; \
353+
ON64(case 8: __EM_ASM_2(op##q, rax, cl); break;) \
354+
EM_ASM_END
355+
347356
/*
348357
* fastop functions have a special calling convention:
349358
*
@@ -1080,13 +1089,13 @@ EM_ASM_1(neg);
10801089
EM_ASM_1(inc);
10811090
EM_ASM_1(dec);
10821091

1083-
FASTOP2CL(rol);
1084-
FASTOP2CL(ror);
1085-
FASTOP2CL(rcl);
1086-
FASTOP2CL(rcr);
1087-
FASTOP2CL(shl);
1088-
FASTOP2CL(shr);
1089-
FASTOP2CL(sar);
1092+
EM_ASM_2CL(rol);
1093+
EM_ASM_2CL(ror);
1094+
EM_ASM_2CL(rcl);
1095+
EM_ASM_2CL(rcr);
1096+
EM_ASM_2CL(shl);
1097+
EM_ASM_2CL(shr);
1098+
EM_ASM_2CL(sar);
10901099

10911100
EM_ASM_2W(bsf);
10921101
EM_ASM_2W(bsr);
@@ -4079,14 +4088,14 @@ static const struct opcode group1A[] = {
40794088
};
40804089

40814090
static const struct opcode group2[] = {
4082-
F(DstMem | ModRM, em_rol),
4083-
F(DstMem | ModRM, em_ror),
4084-
F(DstMem | ModRM, em_rcl),
4085-
F(DstMem | ModRM, em_rcr),
4086-
F(DstMem | ModRM, em_shl),
4087-
F(DstMem | ModRM, em_shr),
4088-
F(DstMem | ModRM, em_shl),
4089-
F(DstMem | ModRM, em_sar),
4091+
I(DstMem | ModRM, em_rol),
4092+
I(DstMem | ModRM, em_ror),
4093+
I(DstMem | ModRM, em_rcl),
4094+
I(DstMem | ModRM, em_rcr),
4095+
I(DstMem | ModRM, em_shl),
4096+
I(DstMem | ModRM, em_shr),
4097+
I(DstMem | ModRM, em_shl),
4098+
I(DstMem | ModRM, em_sar),
40904099
};
40914100

40924101
static const struct opcode group3[] = {

0 commit comments

Comments
 (0)