[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTi=KRVMrNh6MyDh5v-ZGB18iEKkqsW+6Eqp27M5X@mail.gmail.com>
Date: Fri, 22 Oct 2010 19:11:09 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: mingo@...hat.com, hpa@...or.com, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, tglx@...utronix.de
Cc: linux-tip-commits@...r.kernel.org
Subject: Re: [tip:x86/fpu] x86-64, asm: Use fxsaveq/fxrestorq in more places
On Fri, Oct 22, 2010 at 6:20 PM, tip-bot for H. Peter Anvin
<hpa@...or.com> wrote:
>
> Checkin d7acb92fea932ad2e7846480aeacddc2c03c8485 made use of fxsaveq
> in fpu_fxsave() if the assembler supports it; this adds
> fxsaveq/fxrstorq to fxrstor_checking() and fxsave_user() as well.
Hmm. I really think you should be able to do something like this
#ifdef CONFIG_AS_FXSAVEQ
#define FXSAVEQ_INSN "fxsaveq %[fx]"
#define FXRSTORQ_INSN "fxrstorq %[fx]"
#define FX_EXTRA(ptr)
#else
#define FXSAVEQ_INSN "rex64/fxsave (%[fxr])"
#define FXRSTORQ_INSN "rex64/fxrstor (%[fxr])"
#define FX_EXTRA(ptr) [fxr] "R" (ptr)
#endif
and then you should be able to write the actual code something like
asm volatile(FXSAVEQ_INSN
:[fx] "=m" (memory)
:FX_EXTRA(&memory))
and
#define __COMMA_CONCAT(x) ,##x
#define COMMA_CONCAT(x) __COMMA_CONCAT(x)
asm volatile(FXRSTRORQ_INSN
: :[fx] "m" (memory) COMMA_CONCAT(FX_EXTRA(&memory)));
or something like that (obviously you'll need the exception stuff too there).
With no #ifdef's in the actual code. Hmm?
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists