mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Uros Bizjak <ubizjak@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	x86@kernel.org, Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	David Laight <david.laight.linux@gmail.com>
Subject: Re: [tip: x86/cleanups] x86/segment: Use MOVL when reading segment registers
Date: Thu, 12 Mar 2026 12:11:45 -0700	[thread overview]
Message-ID: <38489a10-a081-4dd4-b50c-27c13189acfb@zytor.com> (raw)
In-Reply-To: <CAFULd4bbEGUvz2jR7CmmAX1DVGvEuaMZfn+DANnRD8TVY8cBXw@mail.gmail.com>

Note: I personally *hate* the savesegment() syntax. For one thing, I would
much rather see a more C-like syntax, even if that means making a bunch of
inline functions. Replacing the macro with something that is actually
type-safe would be a bloody good thing, too.

Something like:

/* Generates register operation */
static inline unsigned int ds(void)
{
	unsigned int v;
	asm volatile("mov %%ds,%0" : "=r" (v));
	return v;
}

/* Generates memory operation */
static inline void save_ds(u16 *dst)
{
	asm volatile("mov %%ds,%0" : "=m" (dst));
}

Generating those inlines can be macroized if we really feel the need to, of
course...

	-hpa


  parent reply	other threads:[~2026-03-12 19:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  9:02 [PATCH RESEND v2 1/3] x86: " Uros Bizjak
2026-01-05  9:02 ` [PATCH RESEND v2 2/3] x86/hyperv: Use savesegment() instead of inline asm() to save " Uros Bizjak
2026-01-19 16:22   ` H. Peter Anvin
2026-01-05  9:02 ` [PATCH RESEND v2 3/3] x86/hyperv: Remove ASM_CALL_CONSTRAINT with VMMCALL insn Uros Bizjak
2026-01-19 16:23   ` H. Peter Anvin
2026-01-19 16:22 ` [PATCH RESEND v2 1/3] x86: Use MOVL when reading segment registers H. Peter Anvin
2026-01-20 12:08 ` [tip: x86/cleanups] x86/segment: " tip-bot2 for Uros Bizjak
2026-01-20 12:38   ` H. Peter Anvin
2026-01-20 13:47     ` Uros Bizjak
2026-01-20 14:02       ` Uros Bizjak
2026-01-21 11:49     ` Brian Gerst
2026-01-21 14:08       ` David Laight
2026-01-21 16:16         ` Uros Bizjak
2026-01-21 18:55           ` David Laight
2026-03-12  9:30     ` Uros Bizjak
2026-03-12 18:55       ` H. Peter Anvin
2026-03-12 19:38         ` Uros Bizjak
2026-03-12 18:56       ` H. Peter Anvin
2026-03-12 19:11       ` H. Peter Anvin [this message]
2026-03-12 19:50         ` Uros Bizjak
2026-03-12 22:01           ` 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=38489a10-a081-4dd4-b50c-27c13189acfb@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.laight.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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®