Skip to content

Commit 22472d1

Browse files
jpoimboebonzini
authored andcommitted
x86/kvm: Simplify FOP_SETCC()
SETCC_ALIGN and FOP_ALIGN are both 16. Remove the special casing for FOP_SETCC() and just make it a normal fastop. Signed-off-by: Josh Poimboeuf <[email protected]> Message-Id: <7c13d94d1a775156f7e36eed30509b274a229140.1660837839.git.jpoimboe@kernel.org> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent e27e5be commit 22472d1

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

arch/x86/kvm/emulate.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -446,27 +446,12 @@ static int fastop(struct x86_emulate_ctxt *ctxt, fastop_t fop);
446446
FOP_END
447447

448448
/* Special case for SETcc - 1 instruction per cc */
449-
450-
/*
451-
* Depending on .config the SETcc functions look like:
452-
*
453-
* ENDBR [4 bytes; CONFIG_X86_KERNEL_IBT]
454-
* SETcc %al [3 bytes]
455-
* RET | JMP __x86_return_thunk [1,5 bytes; CONFIG_RETHUNK]
456-
* INT3 [1 byte; CONFIG_SLS]
457-
*/
458-
#define SETCC_ALIGN 16
459-
460449
#define FOP_SETCC(op) \
461-
".align " __stringify(SETCC_ALIGN) " \n\t" \
462-
".type " #op ", @function \n\t" \
463-
#op ": \n\t" \
464-
ASM_ENDBR \
450+
FOP_FUNC(op) \
465451
#op " %al \n\t" \
466-
__FOP_RET(#op) \
467-
".skip " __stringify(SETCC_ALIGN) " - (.-" #op "), 0xcc \n\t"
452+
FOP_RET(op)
468453

469-
__FOP_START(setcc, SETCC_ALIGN)
454+
FOP_START(setcc)
470455
FOP_SETCC(seto)
471456
FOP_SETCC(setno)
472457
FOP_SETCC(setc)
@@ -1079,7 +1064,7 @@ static int em_bsr_c(struct x86_emulate_ctxt *ctxt)
10791064
static __always_inline u8 test_cc(unsigned int condition, unsigned long flags)
10801065
{
10811066
u8 rc;
1082-
void (*fop)(void) = (void *)em_setcc + SETCC_ALIGN * (condition & 0xf);
1067+
void (*fop)(void) = (void *)em_setcc + FASTOP_SIZE * (condition & 0xf);
10831068

10841069
flags = (flags & EFLAGS_MASK) | X86_EFLAGS_IF;
10851070
asm("push %[flags]; popf; " CALL_NOSPEC

0 commit comments

Comments
 (0)