Re: [PATCH 07/11] x86-64: Simplify constraints for fxsave/fxtstor
From: Brian Gerst
Date: Sun Aug 29 2010 - 19:44:42 EST
On Sun, Aug 29, 2010 at 2:45 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> On Sat, Aug 28, 2010 at 7:04 PM, Brian Gerst <brgerst@xxxxxxxxx> 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@xxxxxxxxx>
>> ---
>> Â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.
--
Brian Gerst
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/