public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* x86: asm doubt
@ 2009-03-15 14:16 Sergio Luis
  2009-03-15 16:41 ` Jeremy Fitzhardinge
  0 siblings, 1 reply; 5+ messages in thread
From: Sergio Luis @ 2009-03-15 14:16 UTC (permalink / raw)
  To: Ingo Molnar, Rafael J. Wysocki, Pavel Machek,
	Linux-kernel Mailing List

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-16 16:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-15 14:16 x86: asm doubt Sergio Luis
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox