Skip to content

Commit a3ff531

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/asm: Remove %P operand modifier from altinstr asm templates
The "P" asm operand modifier is a x86 target-specific modifier. For x86_64, when used with a symbol reference, the "%P" modifier emits "sym" instead of "sym(%rip)". This property is currently used to prevent %RIP-relative addressing in .altinstr sections. %RIP-relative addresses are nowadays correctly handled in .altinstr sections, so remove %P operand modifier from altinstr asm templates. Also note that unlike GCC, clang emits %rip-relative symbol reference with "P" asm operand modifier, so the patch also unifies symbol handling with both compilers. No functional changes intended. Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4ae3dc8 commit a3ff531

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arch/x86/include/asm/apic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static inline void native_apic_mem_write(u32 reg, u32 v)
9191
{
9292
volatile u32 *addr = (volatile u32 *)(APIC_BASE + reg);
9393

94-
alternative_io("movl %0, %P1", "xchgl %0, %P1", X86_BUG_11AP,
94+
alternative_io("movl %0, %1", "xchgl %0, %1", X86_BUG_11AP,
9595
ASM_OUTPUT2("=r" (v), "=m" (*addr)),
9696
ASM_OUTPUT2("0" (v), "m" (*addr)));
9797
}

arch/x86/include/asm/processor.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ extern char ignore_fpu_irq;
587587
# define BASE_PREFETCH ""
588588
# define ARCH_HAS_PREFETCH
589589
#else
590-
# define BASE_PREFETCH "prefetcht0 %P1"
590+
# define BASE_PREFETCH "prefetcht0 %1"
591591
#endif
592592

593593
/*
@@ -598,7 +598,7 @@ extern char ignore_fpu_irq;
598598
*/
599599
static inline void prefetch(const void *x)
600600
{
601-
alternative_input(BASE_PREFETCH, "prefetchnta %P1",
601+
alternative_input(BASE_PREFETCH, "prefetchnta %1",
602602
X86_FEATURE_XMM,
603603
"m" (*(const char *)x));
604604
}
@@ -610,7 +610,7 @@ static inline void prefetch(const void *x)
610610
*/
611611
static __always_inline void prefetchw(const void *x)
612612
{
613-
alternative_input(BASE_PREFETCH, "prefetchw %P1",
613+
alternative_input(BASE_PREFETCH, "prefetchw %1",
614614
X86_FEATURE_3DNOWPREFETCH,
615615
"m" (*(const char *)x));
616616
}

arch/x86/include/asm/special_insns.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ static __always_inline void clflush(volatile void *__p)
182182

183183
static inline void clflushopt(volatile void *__p)
184184
{
185-
alternative_io(".byte 0x3e; clflush %P0",
186-
".byte 0x66; clflush %P0",
185+
alternative_io(".byte 0x3e; clflush %0",
186+
".byte 0x66; clflush %0",
187187
X86_FEATURE_CLFLUSHOPT,
188188
"+m" (*(volatile char __force *)__p));
189189
}

0 commit comments

Comments
 (0)