Skip to contentSkip to conversation

cpu_has_fxsr or cpu_has_xmm?

DISCUSSION Quim K Holland 2 participants 2 messages Feb 23, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

"DL" == Doug Ledford <[email protected]> writes:

arch/i386/kernel/i387.c Sun Feb 4 10:58:36 2001 renamed from arch/i386/kernel/i387.c Thu Feb 22 09:05:35 2001 +0 -0
@@ -179,7 +179,7 @@
 
Quoted 8 lines
Quoted 8 lines

arch/i386/kernel/i387.c Sun Feb 4 10:58:36 2001 line 185

Quoted 8 lines
arch/i386/kernel/i387.c Sun Feb 4 10:58:36 2001 renamed from arch/i386/kernel/i387.c Thu Feb 22 09:05:35 2001 +1 -1
 unsigned short get_fpu_mxcsr( struct task_struct *tsk )
 {
-       if ( cpu_has_fxsr ) {
+       if ( cpu_has_xmm ) {
                return tsk->thread.i387.fxsave.mxcsr;
        } else {
                return 0x1f80;

DL> As to the correctness, the mxcsr register really only exists DL> if you have xmm, so the xmm is the correct test. However,...

DL> ... User space programmers should be checking for xmm DL> capability themselves before ever paying attention to mxcsr DL> anyway, so it's not an end of the world error.

If that is the case, wouldn't it be simpler to always return tsk->thread.i387.fxsave.mxcsr from this function, and initialize that field to 0x1f80 (whatever that magic number means) when the structure is built?

------------------------------------------------------------
--== Sent via Deja.com ==--
http://www.deja.com/

#1 lore raw
Quoted 4 lines · Quim K Holland

DL> As to the correctness, the mxcsr register really only exists DL> if you have xmm, so the xmm is the correct test. However,...

Quoted 9 lines

DL> ... User space programmers should be checking for xmm DL> capability themselves before ever paying attention to mxcsr DL> anyway, so it's not an end of the world error.

If that is the case, wouldn't it be simpler to always return tsk->thread.i387.fxsave.mxcsr from this function, and initialize that field to 0x1f80 (whatever that magic number means) when the structure is built?

No, because the CPU *may* overwrite it when you do an FXSAVE.

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt