From: Peter Zijlstra Date: Mon, 21 Mar 2022 09:57:51 +0000 (+0100) Subject: Merge branch 'kvm/kvm-sls-fix' X-Git-Tag: v6.6.17~7889^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9067cd80fbc5b3ae061e5bde6efd19bbf02f9e2;p=platform%2Fkernel%2Flinux-rpi.git Merge branch 'kvm/kvm-sls-fix' Sync with the last minute SLS fix to extend it for IBT. Signed-off-by: Peter Zijlstra --- b9067cd80fbc5b3ae061e5bde6efd19bbf02f9e2 diff --cc arch/x86/kvm/emulate.c index 08c4e9c,e86d610..d98fb36 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@@ -430,11 -429,25 +430,26 @@@ static int fastop(struct x86_emulate_ct FOP_END /* Special case for SETcc - 1 instruction per cc */ + + /* + * Depending on .config the SETcc functions look like: + * + * SETcc %al [3 bytes] + * RET [1 byte] + * INT3 [1 byte; CONFIG_SLS] + * + * Which gives possible sizes 4 or 5. When rounded up to the + * next power-of-two alignment they become 4 or 8. + */ + #define SETCC_LENGTH (4 + IS_ENABLED(CONFIG_SLS)) + #define SETCC_ALIGN (4 << IS_ENABLED(CONFIG_SLS)) + static_assert(SETCC_LENGTH <= SETCC_ALIGN); + #define FOP_SETCC(op) \ - ".align 4 \n\t" \ + ".align " __stringify(SETCC_ALIGN) " \n\t" \ ".type " #op ", @function \n\t" \ #op ": \n\t" \ + ASM_ENDBR \ #op " %al \n\t" \ __FOP_RET(#op)