RE: [PATCH] mxcsr patch for i386 & x86-64

From: Nakajima, Jun
Date: Tue May 04 2004 - 16:53:24 EST


>From: Jeff Garzik [mailto:jgarzik@xxxxxxxxx]
>Sent: Tuesday, May 04, 2004 2:08 PM
>Linus Torvalds wrote:
>> --- 1.19/arch/i386/kernel/i387.c Tue Feb 3 21:30:39 2004
>> +++ edited/arch/i386/kernel/i387.c Tue May 4 13:15:10 2004
>> @@ -24,6 +25,21 @@
>> #define HAVE_HWFP 1
>> #endif
>>
>> +static unsigned long mxcsr_feature_mask = 0xffffffff;
>
>> --- 1.10/arch/x86_64/kernel/i387.c Fri Jan 23 12:17:58 2004
>> +++ edited/arch/x86_64/kernel/i387.c Tue May 4 13:07:35 2004
>> @@ -24,6 +24,18 @@
>> #include <asm/ptrace.h>
>> #include <asm/uaccess.h>
>>
>> +unsigned long mxcsr_feature_mask = 0xffffffff;
>> +
>
>
>Minor/dumb question: Is the above intentional?
>
>Would be nice to have them the same for consistency if nothing else.
>i386 and x86-64 common code gets pasted and #include'd all the time.

If we look at set/get_fpu_xxx in i386 and x86-64, their codes are not
consistent; functions vs. macros. This is mainly because x86-64 can
assume the modern CPU features are available, and thus those are
simplified.

It's not required to make mxcsr_feature_mask global on i386 because
nobody else is using it in other files, but I agree that it would be
better to make it global to avoid potential confusion/mistakes in the
future.

> ===== arch/i386/kernel/i387.c 1.19 vs edited =====
> --- 1.19/arch/i386/kernel/i387.c Tue Feb 3 21:30:39 2004
> +++ edited/arch/i386/kernel/i387.c Tue May 4 13:15:10 2004
> @@ -10,6 +10,7 @@
> ...
> -void set_fpu_mxcsr( struct task_struct *tsk, unsigned short mxcsr )
> -{
> - if ( cpu_has_xmm ) {
> - tsk->thread.i387.fxsave.mxcsr = (mxcsr & 0xffbf);
> - }
> -}
If we do this, then we should check if we can remove other (unused)
set/get_fpu_xxx to make i386 and x86-64 more consistent. For example,
set/get_fpu_fwd() are not used as far as I checked.

Jun

>
> Jeff
>
>

-
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/