Skip to content

Commit 027ea4f

Browse files
committed
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 <[email protected]>
1 parent 5293b5f commit 027ea4f

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

arch/x86/include/asm/smap.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,34 @@
1313
#include <asm/cpufeatures.h>
1414
#include <asm/alternative.h>
1515

16-
/* "Raw" instruction opcodes */
17-
#define __ASM_CLAC ".byte 0x0f,0x01,0xca"
18-
#define __ASM_STAC ".byte 0x0f,0x01,0xcb"
19-
2016
#ifdef __ASSEMBLY__
2117

2218
#define ASM_CLAC \
23-
ALTERNATIVE "", __ASM_CLAC, X86_FEATURE_SMAP
19+
ALTERNATIVE "", "clac", X86_FEATURE_SMAP
2420

2521
#define ASM_STAC \
26-
ALTERNATIVE "", __ASM_STAC, X86_FEATURE_SMAP
22+
ALTERNATIVE "", "stac", X86_FEATURE_SMAP
2723

2824
#else /* __ASSEMBLY__ */
2925

3026
static __always_inline void clac(void)
3127
{
3228
/* Note: a barrier is implicit in alternative() */
33-
alternative("", __ASM_CLAC, X86_FEATURE_SMAP);
29+
alternative("", "clac", X86_FEATURE_SMAP);
3430
}
3531

3632
static __always_inline void stac(void)
3733
{
3834
/* Note: a barrier is implicit in alternative() */
39-
alternative("", __ASM_STAC, X86_FEATURE_SMAP);
35+
alternative("", "stac", X86_FEATURE_SMAP);
4036
}
4137

4238
static __always_inline unsigned long smap_save(void)
4339
{
4440
unsigned long flags;
4541

4642
asm volatile ("# smap_save\n\t"
47-
ALTERNATIVE("", "pushf; pop %0; " __ASM_CLAC "\n\t",
43+
ALTERNATIVE("", "pushf; pop %0; " "clac" "\n\t",
4844
X86_FEATURE_SMAP)
4945
: "=rm" (flags) : : "memory", "cc");
5046

@@ -61,9 +57,9 @@ static __always_inline void smap_restore(unsigned long flags)
6157

6258
/* These macros can be used in asm() statements */
6359
#define ASM_CLAC \
64-
ALTERNATIVE("", __ASM_CLAC, X86_FEATURE_SMAP)
60+
ALTERNATIVE("", "clac", X86_FEATURE_SMAP)
6561
#define ASM_STAC \
66-
ALTERNATIVE("", __ASM_STAC, X86_FEATURE_SMAP)
62+
ALTERNATIVE("", "stac", X86_FEATURE_SMAP)
6763

6864
#endif /* __ASSEMBLY__ */
6965

0 commit comments

Comments
 (0)