lkml.org 
[lkml]   [2010]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/11] x86-64: Simplify constraints for fxsave/fxtstor
  On 8/30/10 2:44 AM, Brian Gerst wrote:
> On Sun, Aug 29, 2010 at 2:45 PM, Pekka Enberg<penberg@kernel.org> wrote:
>> On Sat, Aug 28, 2010 at 7:04 PM, Brian Gerst<brgerst@gmail.com> wrote:
>>> Use the "R" constraint (legacy register) instead of listing all the
>>> possible registers. Clean up the comments as well.
>>>
>>> Signed-off-by: Brian Gerst<brgerst@gmail.com>
>>> ---
>>> arch/x86/include/asm/i387.h | 44 ++++++++++++++++--------------------------
>>> 1 files changed, 17 insertions(+), 27 deletions(-)
>>>
>>> diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
>>> index 8b40a83..768fcb2 100644
>>> --- a/arch/x86/include/asm/i387.h
>>> +++ b/arch/x86/include/asm/i387.h
>>> @@ -81,6 +81,7 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
>>> {
>>> int err;
>>>
>>> + /* See comment in fxsave() below. */
>>> asm volatile("1: rex64/fxrstor (%[fx])\n\t"
>>> "2:\n"
>>> ".section .fixup,\"ax\"\n"
>>> @@ -89,11 +90,7 @@ static inline int fxrstor_checking(struct i387_fxsave_struct *fx)
>>> ".previous\n"
>>> _ASM_EXTABLE(1b, 3b)
>>> : [err] "=r" (err)
>>> -#if 0 /* See comment in fxsave() below. */
>>> - : [fx] "r" (fx), "m" (*fx), "0" (0));
>>> -#else
>>> - : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));
>>> -#endif
>>> + : [fx] "R" (fx), "m" (*fx), "0" (0));
>> Please correct me if I'm wrong but "legacy registers" also include bp
>> and sp that are not part of the original constraints:
>>
>> http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html
>>
>> So why is it OK to use "R" here?
> There is no constraint to explicitly request %bp (or %sp), but there
> is no reason it could not be used. The compiler would never choose
> %sp for "R" for the same reason it wouldn't for "r": it's not
> available as a general purpose register.
Yeah, if I try to force GCC to use bp or sp, it will complain that it
runs out of legacy registers:

error: can't find a register in class `LEGACY_REGS' while reloading `asm'

which makes sense as it knows that sp and bp are used by the function
that contains the inline asm.

Acked-by: Pekka Enberg <penberg@kernel.org>

Pekka


\
 
 \ /
  Last update: 2010-08-30 07:59    [W:0.053 / U:30.300 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site