From: "H. Peter Anvin" <hpa@zytor.com>
To: Uros Bizjak <ubizjak@gmail.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: [PATCH RESEND] x86/kexec: store segment registers directly to memory in crash_setup_regs()
Date: Sun, 6 Sep 2026 18:33:27 -0700 [thread overview]
Message-ID: <fe6933ae-5684-4c5a-8c99-1d80f583a101@zytor.com> (raw)
In-Reply-To: <20260906183942.103011-1-ubizjak@gmail.com>
On 2026-09-06 11:39, Uros Bizjak wrote:
> crash_setup_regs() currently moves segment registers (ss, cs, ds, es)
> into pt_regs via a general purpose register (%eax). Update the code to
> avoid the intermediate register and store segment registers directly
> to their destination fields. This reduces the generated code from:
>
> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
> index 5cfb27f26583..ad7ef567452b 100644
> --- a/arch/x86/include/asm/kexec.h
> +++ b/arch/x86/include/asm/kexec.h
> @@ -106,11 +106,11 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
> asm volatile("mov %%r14,%0" : "=m"(newregs->r14));
> asm volatile("mov %%r15,%0" : "=m"(newregs->r15));
> #endif
> - asm volatile("mov %%ss,%k0" : "=a"(newregs->ss));
> - asm volatile("mov %%cs,%k0" : "=a"(newregs->cs));
> + asm volatile("mov %%ss,%0" : "=m"(newregs->ss));
> + asm volatile("mov %%cs,%0" : "=m"(newregs->cs));
> #ifdef CONFIG_X86_32
> - asm volatile("mov %%ds,%k0" : "=a"(newregs->ds));
> - asm volatile("mov %%es,%k0" : "=a"(newregs->es));
> + asm volatile("mov %%ds,%0" : "=m"(newregs->ds));
> + asm volatile("mov %%es,%0" : "=m"(newregs->es));
> #endif
> asm volatile("pushf\n\t"
> "pop %0" : "=m"(newregs->flags));
Why not use "=rm"? "=a" seems odd in the extreme.
-hpa
next prev parent reply other threads:[~2026-09-07 1:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 18:39 Uros Bizjak
2026-09-07 1:33 ` H. Peter Anvin [this message]
2026-09-07 4:42 ` Uros Bizjak
2026-09-16 18:20 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=fe6933ae-5684-4c5a-8c99-1d80f583a101@zytor.com \
--to=hpa@zytor.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@kernel.org \
--cc=ubizjak@gmail.com \
--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
all inboxes | Powered by JetHome®