Skip to content

Commit 41cd2e1

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/asm: Use %c/%n instead of %P operand modifier in asm templates
The "P" asm operand modifier is a x86 target-specific modifier. When used with a constant, the "P" modifier emits "cst" instead of "$cst". This property is currently used to emit the bare constant without all syntax-specific prefixes. The generic "c" resp. "n" operand modifier should be used instead. 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 a3ff531 commit 41cd2e1

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

arch/x86/boot/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ static void init_heap(void)
119119
char *stack_end;
120120

121121
if (boot_params.hdr.loadflags & CAN_USE_HEAP) {
122-
asm("leal %P1(%%esp),%0"
123-
: "=r" (stack_end) : "i" (-STACK_SIZE));
122+
asm("leal %n1(%%esp),%0"
123+
: "=r" (stack_end) : "i" (STACK_SIZE));
124124

125125
heap_end = (char *)
126126
((size_t)boot_params.hdr.heap_end_ptr + 0x200);

arch/x86/include/asm/alternative.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ static inline int alternatives_text_reserved(void *start, void *end)
294294
* Otherwise, if CPU has feature1, newinstr1 is used.
295295
* Otherwise, oldinstr is used.
296296
*/
297-
#define alternative_input_2(oldinstr, newinstr1, ft_flags1, newinstr2, \
298-
ft_flags2, input...) \
299-
asm_inline volatile(ALTERNATIVE_2(oldinstr, newinstr1, ft_flags1, \
300-
newinstr2, ft_flags2) \
297+
#define alternative_input_2(oldinstr, newinstr1, ft_flags1, newinstr2, \
298+
ft_flags2, input...) \
299+
asm_inline volatile(ALTERNATIVE_2(oldinstr, newinstr1, ft_flags1, \
300+
newinstr2, ft_flags2) \
301301
: : "i" (0), ## input)
302302

303303
/* Like alternative_input, but with a single output argument */
@@ -307,7 +307,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
307307

308308
/* Like alternative_io, but for replacing a direct call with another one. */
309309
#define alternative_call(oldfunc, newfunc, ft_flags, output, input...) \
310-
asm_inline volatile (ALTERNATIVE("call %P[old]", "call %P[new]", ft_flags) \
310+
asm_inline volatile (ALTERNATIVE("call %c[old]", "call %c[new]", ft_flags) \
311311
: output : [old] "i" (oldfunc), [new] "i" (newfunc), ## input)
312312

313313
/*
@@ -316,12 +316,12 @@ static inline int alternatives_text_reserved(void *start, void *end)
316316
* Otherwise, if CPU has feature1, function1 is used.
317317
* Otherwise, old function is used.
318318
*/
319-
#define alternative_call_2(oldfunc, newfunc1, ft_flags1, newfunc2, ft_flags2, \
320-
output, input...) \
321-
asm_inline volatile (ALTERNATIVE_2("call %P[old]", "call %P[new1]", ft_flags1,\
322-
"call %P[new2]", ft_flags2) \
323-
: output, ASM_CALL_CONSTRAINT \
324-
: [old] "i" (oldfunc), [new1] "i" (newfunc1), \
319+
#define alternative_call_2(oldfunc, newfunc1, ft_flags1, newfunc2, ft_flags2, \
320+
output, input...) \
321+
asm_inline volatile (ALTERNATIVE_2("call %c[old]", "call %c[new1]", ft_flags1, \
322+
"call %c[new2]", ft_flags2) \
323+
: output, ASM_CALL_CONSTRAINT \
324+
: [old] "i" (oldfunc), [new1] "i" (newfunc1), \
325325
[new2] "i" (newfunc2), ## input)
326326

327327
/*

arch/x86/include/asm/atomic64_32.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ typedef struct {
2424

2525
#ifdef CONFIG_X86_CMPXCHG64
2626
#define __alternative_atomic64(f, g, out, in...) \
27-
asm volatile("call %P[func]" \
27+
asm volatile("call %c[func]" \
2828
: out : [func] "i" (atomic64_##g##_cx8), ## in)
2929

3030
#define ATOMIC64_DECL(sym) ATOMIC64_DECL_ONE(sym##_cx8)

arch/x86/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit);
169169
static __always_inline bool _static_cpu_has(u16 bit)
170170
{
171171
asm goto(
172-
ALTERNATIVE_TERNARY("jmp 6f", %P[feature], "", "jmp %l[t_no]")
172+
ALTERNATIVE_TERNARY("jmp 6f", %c[feature], "", "jmp %l[t_no]")
173173
".pushsection .altinstr_aux,\"ax\"\n"
174174
"6:\n"
175175
" testb %[bitnum]," _ASM_RIP(%P[cap_byte]) "\n"

arch/x86/include/asm/irq_stack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
}
101101

102102
#define ASM_CALL_ARG0 \
103-
"call %P[__func] \n" \
103+
"call %c[__func] \n" \
104104
ASM_REACHABLE
105105

106106
#define ASM_CALL_ARG1 \

arch/x86/include/asm/uaccess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern int __get_user_bad(void);
7878
int __ret_gu; \
7979
register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
8080
__chk_user_ptr(ptr); \
81-
asm volatile("call __" #fn "_%P4" \
81+
asm volatile("call __" #fn "_%c4" \
8282
: "=a" (__ret_gu), "=r" (__val_gu), \
8383
ASM_CALL_CONSTRAINT \
8484
: "0" (ptr), "i" (sizeof(*(ptr)))); \
@@ -177,7 +177,7 @@ extern void __put_user_nocheck_8(void);
177177
__chk_user_ptr(__ptr); \
178178
__ptr_pu = __ptr; \
179179
__val_pu = __x; \
180-
asm volatile("call __" #fn "_%P[size]" \
180+
asm volatile("call __" #fn "_%c[size]" \
181181
: "=c" (__ret_pu), \
182182
ASM_CALL_CONSTRAINT \
183183
: "0" (__ptr_pu), \

0 commit comments

Comments
 (0)