mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-01 01:14:19 -04:00
x86: use proper 'clac' and 'stac' opcode names
Back when we added SMAP support, all versions of binutils didn't necessarily understand the 'clac' and 'stac' instructions. So we implemented those instructions manually as ".byte" sequences. But we've since upgraded the minimum version of binutils to version 2.25, and that included proper support for the SMAP instructions, and there's no reason for us to use some line noise to express them any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
@@ -13,30 +13,26 @@
|
||||
#include <asm/cpufeatures.h>
|
||||
#include <asm/alternative.h>
|
||||
|
||||
/* "Raw" instruction opcodes */
|
||||
#define __ASM_CLAC ".byte 0x0f,0x01,0xca"
|
||||
#define __ASM_STAC ".byte 0x0f,0x01,0xcb"
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
|
||||
#define ASM_CLAC \
|
||||
ALTERNATIVE "", __ASM_CLAC, X86_FEATURE_SMAP
|
||||
ALTERNATIVE "", "clac", X86_FEATURE_SMAP
|
||||
|
||||
#define ASM_STAC \
|
||||
ALTERNATIVE "", __ASM_STAC, X86_FEATURE_SMAP
|
||||
ALTERNATIVE "", "stac", X86_FEATURE_SMAP
|
||||
|
||||
#else /* __ASSEMBLY__ */
|
||||
|
||||
static __always_inline void clac(void)
|
||||
{
|
||||
/* Note: a barrier is implicit in alternative() */
|
||||
alternative("", __ASM_CLAC, X86_FEATURE_SMAP);
|
||||
alternative("", "clac", X86_FEATURE_SMAP);
|
||||
}
|
||||
|
||||
static __always_inline void stac(void)
|
||||
{
|
||||
/* Note: a barrier is implicit in alternative() */
|
||||
alternative("", __ASM_STAC, X86_FEATURE_SMAP);
|
||||
alternative("", "stac", X86_FEATURE_SMAP);
|
||||
}
|
||||
|
||||
static __always_inline unsigned long smap_save(void)
|
||||
@@ -44,7 +40,7 @@ static __always_inline unsigned long smap_save(void)
|
||||
unsigned long flags;
|
||||
|
||||
asm volatile ("# smap_save\n\t"
|
||||
ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
|
||||
ALTERNATIVE("", "pushf; pop %0; " "clac" "\n\t",
|
||||
X86_FEATURE_SMAP)
|
||||
: "=rm" (flags) : : "memory", "cc");
|
||||
|
||||
@@ -61,9 +57,9 @@ static __always_inline void smap_restore(unsigned long flags)
|
||||
|
||||
/* These macros can be used in asm() statements */
|
||||
#define ASM_CLAC \
|
||||
ALTERNATIVE("", __ASM_CLAC, X86_FEATURE_SMAP)
|
||||
ALTERNATIVE("", "clac", X86_FEATURE_SMAP)
|
||||
#define ASM_STAC \
|
||||
ALTERNATIVE("", __ASM_STAC, X86_FEATURE_SMAP)
|
||||
ALTERNATIVE("", "stac", X86_FEATURE_SMAP)
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user