The following commit has been merged into the x86/asm branch of tip:
Commit-ID: 81310ce4287a23b8ff6e8684de73cfaae88782ca
Gitweb: https://git.kernel.org/tip/81310ce4287a23b8ff6e8684de73cfaae88782ca
Author: Uros Bizjak <ubizjak@gmail.com>
AuthorDate: Mon, 30 Mar 2026 10:59:21 +02:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 31 Mar 2026 09:50:10 +02:00
x86/process/64: Use savesegment() in __show_regs() instead of inline asm
Replace direct 'movl' instructions for DS, ES, FS, and GS read in
__show_regs() with the savesegment() helper. This improves
readability, consistency, and ensures proper handling of
segment registers on x86_64.
No functional change intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://patch.msgid.link/20260330085938.67985-2-ubizjak@gmail.com
---
arch/x86/kernel/process_64.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 08e72f4..b85e715 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -104,10 +104,10 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode,
return;
}
- asm("movl %%ds,%0" : "=r" (ds));
- asm("movl %%es,%0" : "=r" (es));
- asm("movl %%fs,%0" : "=r" (fsindex));
- asm("movl %%gs,%0" : "=r" (gsindex));
+ savesegment(ds, ds);
+ savesegment(es, es);
+ savesegment(fs, fsindex);
+ savesegment(gs, gsindex);
rdmsrq(MSR_FS_BASE, fs);
rdmsrq(MSR_GS_BASE, gs);