Date: Mon, 16 Sep 1996 15:51:07 +0900 From: KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp> To: current@freebsd.org Subject: Cyrix/Ti/IBM 486 & Cyrix 5x86 FPU problem Message-ID: <199609160651.PAA00299@marble.eps.nagoya-u.ac.jp>
next in thread | raw e-mail | index | archive | help
Hi, Cyrix/Ti/IBM 486 and Cyrix 5x86 users,
I would provide the solution of another non-Intel CPU problem for
FreeBSD-current.
Exception 16 (FPU error) could not be handled on some machines with
Cyrix/Ti/IBM 486 CPU, even though 80387 (or its compatible) is
installed correctly.  In such case, kernel says:
	no 387 emulator in kernel in kernel!
and FPU error (e.g., divided by 0, sqrt of negative number) cannot be
detected.  This problem also appears on Cyrix 5x86 machines when
undocumented feature of `faster FPU exception handler' is enabled.
The following patch provides a trick to pretend FPU detected and makes
kernel use exception 16 to catch FPU error.  This feature is #ifdef'ed
since it is harmful on 386/i486SX machine without FPU.  Please add
"options FPU_ERROR_BROKEN" line in your kernel configuration file.
After npxattach routine detects FPU, exception 16 interface may work
correctly, i.e., you can detect divided by 0 error, etc.
Enjoy!
---------- BEGIN ----------
*** npx.c.orig	Mon Sep 16 14:45:50 1996
--- npx.c	Mon Sep 16 14:46:46 1996
***************
*** 274,279 ****
--- 274,288 ----
  			 */
  			control &= ~(1 << 2);	/* enable divide by 0 trap */
  			fldcw(&control);
+ #ifdef FPU_ERROR_BROKEN
+ 			/*
+ 			 * FPU error signal doesn't work on some CPU
+ 			 * accelerator board.
+ 			 */
+ 			npx_ex16 = 1;
+ 			dvp->id_irq = 0;
+ 			return (-1);
+ #endif
  			npx_traps_while_probing = npx_intrs_while_probing = 0;
  			fp_divide_by_0();
  			if (npx_traps_while_probing != 0) {
---------- END ----------
----
KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp>
Dept. Earth Planet. Sci., Nagoya Univ.,  Nagoya, 464-01, Japan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609160651.PAA00299>
