x86/smap: Use ALTERNATIVE macro
... and drop unfolded version. No need for ASM_NOP3 anymore either as the alternatives do the proper padding at build time and insert proper NOPs at boot time. There should be no apparent operational change from this patch. Signed-off-by: Borislav Petkov <bp@suse.de>
This commit is contained in:
parent
de2ff88884
commit
669f8a9001
|
@ -28,22 +28,10 @@
|
|||
#ifdef CONFIG_X86_SMAP
|
||||
|
||||
#define ASM_CLAC \
|
||||
661: ASM_NOP3 ; \
|
||||
.pushsection .altinstr_replacement, "ax" ; \
|
||||
662: __ASM_CLAC ; \
|
||||
.popsection ; \
|
||||
.pushsection .altinstructions, "a" ; \
|
||||
altinstruction_entry 661b, 662b, X86_FEATURE_SMAP, 3, 3, 0 ; \
|
||||
.popsection
|
||||
ALTERNATIVE "", __stringify(__ASM_CLAC), X86_FEATURE_SMAP
|
||||
|
||||
#define ASM_STAC \
|
||||
661: ASM_NOP3 ; \
|
||||
.pushsection .altinstr_replacement, "ax" ; \
|
||||
662: __ASM_STAC ; \
|
||||
.popsection ; \
|
||||
.pushsection .altinstructions, "a" ; \
|
||||
altinstruction_entry 661b, 662b, X86_FEATURE_SMAP, 3, 3, 0 ; \
|
||||
.popsection
|
||||
ALTERNATIVE "", __stringify(__ASM_STAC), X86_FEATURE_SMAP
|
||||
|
||||
#else /* CONFIG_X86_SMAP */
|
||||
|
||||
|
@ -61,20 +49,20 @@
|
|||
static __always_inline void clac(void)
|
||||
{
|
||||
/* Note: a barrier is implicit in alternative() */
|
||||
alternative(ASM_NOP3, __stringify(__ASM_CLAC), X86_FEATURE_SMAP);
|
||||
alternative("", __stringify(__ASM_CLAC), X86_FEATURE_SMAP);
|
||||
}
|
||||
|
||||
static __always_inline void stac(void)
|
||||
{
|
||||
/* Note: a barrier is implicit in alternative() */
|
||||
alternative(ASM_NOP3, __stringify(__ASM_STAC), X86_FEATURE_SMAP);
|
||||
alternative("", __stringify(__ASM_STAC), X86_FEATURE_SMAP);
|
||||
}
|
||||
|
||||
/* These macros can be used in asm() statements */
|
||||
#define ASM_CLAC \
|
||||
ALTERNATIVE(ASM_NOP3, __stringify(__ASM_CLAC), X86_FEATURE_SMAP)
|
||||
ALTERNATIVE("", __stringify(__ASM_CLAC), X86_FEATURE_SMAP)
|
||||
#define ASM_STAC \
|
||||
ALTERNATIVE(ASM_NOP3, __stringify(__ASM_STAC), X86_FEATURE_SMAP)
|
||||
ALTERNATIVE("", __stringify(__ASM_STAC), X86_FEATURE_SMAP)
|
||||
|
||||
#else /* CONFIG_X86_SMAP */
|
||||
|
||||
|
|
Loading…
Reference in New Issue