mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergio Luis <eeeesti@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, "Rafael J. Wysocki" <rjw@sisk.pl>,
	Pavel Machek <pavel@suse.cz>,
	Linux-kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: x86: asm doubt
Date: Sun, 15 Mar 2009 11:16:24 -0300	[thread overview]
Message-ID: <ce0170d90903150716t14033a9dr3b3bf028933dde7c@mail.gmail.com> (raw)

Hi there,

taking a look at arch/x86/power/cpu_(32|64).c, I saw the 32.c one
using the following macros

#define savesegment(seg, value)                         \
        asm("mov %%" #seg ",%0":"=r" (value) : : "memory")


#define loadsegment(seg, value)                 \
        asm volatile("\n"                       \
                     "1:\t"                     \
                     "movl %k0,%%" #seg "\n"    \
                     "2:\n"                     \
                     ".section .fixup,\"ax\"\n" \
                     "3:\t"                     \
                     "movl %k1, %%" #seg "\n\t" \
                     "jmp 2b\n"                 \
                     ".previous\n"              \
                     _ASM_EXTABLE(1b,3b)        \
                     : :"r" (value), "r" (0) : "memory")


saving and loading segment registers as in

savesegment(es, ctxt->es);
loadsegment(es, ctxt->es);

the code in cpu_64.c doesn't make use of such macros, doing the following:

saving:
 asm volatile ("movw %%es, %0" : "=m" (ctxt->es));

loading:
asm volatile ("movw %0, %%es" :: "r" (ctxt->es));

So, my question is... what's the actual difference between both
versions? Aren't the macros suitable for the 64 version as well?

Thanks,
Sergio.

             reply	other threads:[~2009-03-15 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-15 14:16 Sergio Luis [this message]
2009-03-15 16:41 ` Jeremy Fitzhardinge
2009-03-16 13:12   ` Sergio Luis
2009-03-16 14:12   ` Avi Kivity
2009-03-16 16:20     ` Jeremy Fitzhardinge

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=ce0170d90903150716t14033a9dr3b3bf028933dde7c@mail.gmail.com \
    --to=eeeesti@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    /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®