OSDN Git Service

Merge branch 'kvm/kvm-sls-fix'
authorPeter Zijlstra <peterz@infradead.org>
Mon, 21 Mar 2022 09:57:51 +0000 (10:57 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 22 Mar 2022 20:12:14 +0000 (21:12 +0100)
Sync with the last minute SLS fix to extend it for IBT.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
1  2 
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)