From owner-freebsd-current Sun Sep 15 23:51:45 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id XAA16249 for current-outgoing; Sun, 15 Sep 1996 23:51:45 -0700 (PDT) Received: from marble.eps.nagoya-u.ac.jp (marble.eps.nagoya-u.ac.jp [133.6.57.68]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id XAA16233 for ; Sun, 15 Sep 1996 23:51:19 -0700 (PDT) Received: from marble.eps.nagoya-u.ac.jp (localhost [127.0.0.1]) by marble.eps.nagoya-u.ac.jp (8.7.4+2.6Wbeta6/3.3W9) with ESMTP id PAA00299 for ; Mon, 16 Sep 1996 15:51:08 +0900 (JST) Message-Id: <199609160651.PAA00299@marble.eps.nagoya-u.ac.jp> To: current@freebsd.org Subject: Cyrix/Ti/IBM 486 & Cyrix 5x86 FPU problem X-Mailer: Mew version 1.05+ on Emacs 19.28.1, Mule 2.3 X-PGP-Fingerprint: 03 72 85 36 62 46 23 03 52 B1 10 22 44 10 0D 9E Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Date: Mon, 16 Sep 1996 15:51:07 +0900 From: KATO Takenori Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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 Dept. Earth Planet. Sci., Nagoya Univ., Nagoya, 464-01, Japan