Skip to contentSkip to conversation

FPU-intensive programs crashing with floating point exception on Cyrix MII

PATCH Ondrej Zary 2 participants 2 messages Aug 17, 2005

lore
Share & tools
lore
#0 lore raw

My machine (Cyrix MII PR300 CPU, PCPartner TXB820DS board with i430TX chipset) exhibits a really weird problem:
When I run a program that uses FPU, it sometimes crashes with "flaoting point exception" - for example, when playing MP3 files using any player. Or with Prime95 - http://www.mersenne.org/freesoft.htm - the "torture test" does not crash but shows "fatal error" in less than 10 minutes. It might be something like this:
http://lists.suse.com/archive/suse-linux-e/2000-Sep/1080.html
or this
http://lists.slug.org.au/archives/slug/2000/11/msg00343.html

The problem appears on 2.4.x kernels and 2.6.x kernels. It works fine in Windows 98 - it can play MP3s and run Prime95 for hours without any problems.
I've tracked it down to math_error() in arch/i386/kernel/traps.c and "fixed" it (I really don't know anything about FPU programming). The patch is attached. It fixes my system - with the patch, I can play MP3s fine and Prime95 runs without any problems too.

Does anyone know why these exceptions happen and/or what's the correct solution?

Signature · 1 line
Ondrej Zary
arch/i386/kernel/traps.c renamed from arch/i386/kernel/traps.c~ +4 -1
@@ -790,8 +790,11 @@
 	 */
 	cwd = get_fpu_cwd(task);
 	swd = get_fpu_swd(task);
+	printk("MATH ERROR %d\n",((~cwd) & swd & 0x3f) | (swd & 0x240));
 	switch (((~cwd) & swd & 0x3f) | (swd & 0x240)) {
-		case 0x000:
+		case 0x000: /* Hack for Cyrix problems */
+		case 0x200:
+			return;                                
 		default:
 			break;
 		case 0x001: /* Invalid Op */
#1 lore raw
Quoted 19 lines · Ondrej Zary

My machine (Cyrix MII PR300 CPU, PCPartner TXB820DS board with i430TX chipset) exhibits a really weird problem:
When I run a program that uses FPU, it sometimes crashes with "flaoting point exception" - for example, when playing MP3 files using any player. Or with Prime95 - http://www.mersenne.org/freesoft.htm - the "torture test" does not crash but shows "fatal error" in less than 10 minutes. It might be something like this:
http://lists.suse.com/archive/suse-linux-e/2000-Sep/1080.html
or this
http://lists.slug.org.au/archives/slug/2000/11/msg00343.html

The problem appears on 2.4.x kernels and 2.6.x kernels. It works fine in Windows 98 - it can play MP3s and run Prime95 for hours without any problems.
I've tracked it down to math_error() in arch/i386/kernel/traps.c and "fixed" it (I really don't know anything about FPU programming). The patch is attached. It fixes my system - with the patch, I can play MP3s fine and Prime95 runs without any problems too.

Quoted 6 lines

Does anyone know why these exceptions happen and/or what's the correct solution?

--
Ondrej Zary

0x200 is way up into the "condition" codes. There should have never been an interrupt at all! Your "fix" is as good as you can get.

Quoted 1 line

Cheers,
Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips). Warning : 98.36% of all statistics are fiction.
.
I apologize for the following. I tried to kill it with the above dot :

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.