From: Ingo Molnar <mingo@kernel.org>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@kernel.org>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Subject: Re: [PATCH 1/2] x86/segment: Introduce storesegment() helper to write segment selectors to memory
Date: Tue, 31 Mar 2026 08:56:49 +0200 [thread overview]
Message-ID: <actwMQFHpYvAfUqm@gmail.com> (raw)
In-Reply-To: <20260331063838.108857-1-ubizjak@gmail.com>
* Uros Bizjak <ubizjak@gmail.com> wrote:
> Introduce a new helper, storesegment(), that stores a segment selector
> directly into a u16 (or compatible) memory location without using an
> intermediate general-purpose register.
>
> To support this, split the existing SAVE_SEGMENT macro into two parts:
>
> SAVE_SEGMENT_VAR(): retains the current behavior of reading a segment
> register into an unsigned long via a register.
> SAVE_SEGMENT_PTR(): adds a new variant that writes the 16-bit selector
> directly to memory.
>
> The combined SAVE_SEGMENT() macro now generates both helpers for each
> segment register.
>
> The new storesegment() interface is preferred over savesegment() when
> the value only needs to be stored (e.g. into a struct field), avoiding
> an unnecessary register move and making the intent clearer.
>
> No functional change for existing users of savesegment().
Why does the API have to be split into =r and =m variants?
Coulnd't we use a more generic constraint and let the compiler
decide what the target is? Would that negatively impact
other aspects of code generation?
Thanks,
Ingo
next prev parent reply other threads:[~2026-03-31 6:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 6:38 [PATCH 1/2] x86/segment: Introduce storesegment() helper to write segment selectors to memory Uros Bizjak
2026-03-31 6:38 ` [PATCH 2/2] x86/process: Use storesegment() when saving segment selectors Uros Bizjak
2026-03-31 6:56 ` Ingo Molnar [this message]
2026-03-31 9:53 ` [PATCH 1/2] x86/segment: Introduce storesegment() helper to write segment selectors to memory Uros Bizjak
2026-03-31 9:59 ` Uros Bizjak
2026-04-01 6:40 ` Ingo Molnar
2026-04-01 6:59 ` Uros Bizjak
2026-04-01 7:02 ` Ingo Molnar
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=actwMQFHpYvAfUqm@gmail.com \
--to=mingo@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.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