From: Uros Bizjak <ubizjak@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>,
Andy Lutomirski <luto@kernel.org>,
Brian Gerst <brgerst@gmail.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Sean Christopherson <seanjc@google.com>
Subject: [PATCH -tip 0/3] x86/asm: Use generic asm operand modifiers instead of %P in asm templates
Date: Tue, 19 Mar 2024 11:40:11 +0100 [thread overview]
Message-ID: <20240319104418.284519-1-ubizjak@gmail.com> (raw)
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)". When used with a constant, the
"P" modifier emits "cst" instead of "$cst". This property is used to
emit bare symbol references and bare constants without all
syntax-specific prefixes.
The generic "c", "n" and "a" operand modifiers should be used instead.
The following table shows the modifiers supported by all targets and
their effects:
Modifier Description
-----------------------------------------------------------
'c' Require a constant operand and print the
constant expression with no punctuation.
'n' Like '%c' except that the value of the constant
is negated before printing.
'a' Substitute a memory reference, with the actual
operand treated as the address. This may be
useful when outputting a "load address"
instruction, because often the assembler syntax
for such an instruction requires you to write
the operand as if it were a memory reference.
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 <ubizjak@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Uros Bizjak (3):
x86/asm: Remove %P operand modifier from altinstr asm templates
x86/asm: Use %c/%n instead of %P operand modifier in asm templates
x86/asm: Use %a instead of %P operand modifier in asm templates
arch/x86/boot/main.c | 4 ++--
arch/x86/include/asm/alternative.h | 22 +++++++++++-----------
arch/x86/include/asm/apic.h | 2 +-
arch/x86/include/asm/atomic64_32.h | 2 +-
arch/x86/include/asm/cpufeature.h | 4 ++--
arch/x86/include/asm/irq_stack.h | 2 +-
arch/x86/include/asm/processor.h | 6 +++---
arch/x86/include/asm/special_insns.h | 4 ++--
arch/x86/include/asm/uaccess.h | 4 ++--
9 files changed, 25 insertions(+), 25 deletions(-)
--
2.44.0
next reply other threads:[~2024-03-19 10:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-19 10:40 Uros Bizjak [this message]
2024-03-19 10:40 ` [PATCH -tip 1/3] x86/asm: Remove %P operand modifier from altinstr asm templates Uros Bizjak
2024-03-19 12:31 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2024-03-19 10:40 ` [PATCH -tip 2/3] x86/asm: Use %c/%n instead of %P operand modifier in " Uros Bizjak
2024-03-19 12:31 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2024-03-19 10:40 ` [PATCH -tip 3/3] x86/asm: Use %a " Uros Bizjak
2024-03-19 12:31 ` [tip: x86/asm] " tip-bot2 for Uros Bizjak
2024-03-19 12:45 ` [PATCH -tip 0/3] x86/asm: Use generic asm operand modifiers instead of %P " Borislav Petkov
2024-03-19 13:09 ` Brian Gerst
2024-03-19 13:24 ` Uros Bizjak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240319104418.284519-1-ubizjak@gmail.com \
--to=ubizjak@gmail.com \
--cc=brgerst@gmail.com \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=seanjc@google.com \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox