]> Zhao Yanbai Git Server - minix.git/commitdiff
kernel: fpu_init: only enable OSXMMEXCPT in CR4 on at least SSE1 machines.
authorBen Gras <ben@minix3.org>
Wed, 28 Apr 2010 13:51:02 +0000 (13:51 +0000)
committerBen Gras <ben@minix3.org>
Wed, 28 Apr 2010 13:51:02 +0000 (13:51 +0000)
Found and debugged by totalinux at yandex.ru and Evgeniy Ivanov, thanks!

kernel/arch/i386/arch_system.c

index 67e19f0582de79a7667c7b5907e2f9df9aa82bfe..934bea2a97ef43710f91fec6483dbb139370d8c3 100644 (file)
@@ -154,9 +154,15 @@ PRIVATE void fpu_init(void)
                if(_cpufeature(_CPUF_I386_FXSR)) {
                        register struct proc *rp;
                        phys_bytes aligned_fp_area;
+                       u32_t cr4 = read_cr4() | CR4_OSFXSR; /* Enable FXSR. */
 
-                       /* Enable FXSR feature usage. */
-                       write_cr4(read_cr4() | CR4_OSFXSR | CR4_OSXMMEXCPT);
+                       /* OSXMMEXCPT if supported
+                        * FXSR feature can be available without SSE
+                        */
+                       if(_cpufeature(_CPUF_I386_SSE))
+                               cr4 |= CR4_OSXMMEXCPT; 
+
+                       write_cr4(cr4);
                        osfxsr_feature = 1;
 
                        for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {