Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/isa Make work on FPU-less computers again - if...



details:   https://anonhg.NetBSD.org/src/rev/89e4955909fe
branches:  trunk
changeset: 524863:89e4955909fe
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Apr 01 08:11:56 2002 +0000

description:
Make work on FPU-less computers again - if FPU is not detected in
npxprobe1(), set npxdna_func to new npxdna_empty(). This function just
returns 0 and thus fallbacks to a T_DNA trap (and math emulate, if present).
This fixes kern/15828 by Masaru Oki, tested on 386DX machine.
Reviewed by Jason Thorpe.

make npxdna_s87() and npxdna_xmm() static
g/c (npx_type == NPX_NONE) test from npxdna_s87(), it's no longer needed

diffstat:

 sys/arch/i386/isa/npx.c |  31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diffs (79 lines):

diff -r bd37d22c933d -r 89e4955909fe sys/arch/i386/isa/npx.c
--- a/sys/arch/i386/isa/npx.c   Mon Apr 01 07:51:58 2002 +0000
+++ b/sys/arch/i386/isa/npx.c   Mon Apr 01 08:11:56 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npx.c,v 1.84 2002/01/10 03:46:17 enami Exp $   */
+/*     $NetBSD: npx.c,v 1.85 2002/04/01 08:11:56 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1994, 1995, 1998 Charles M. Hannum.  All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.84 2002/01/10 03:46:17 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npx.c,v 1.85 2002/04/01 08:11:56 jdolecek Exp $");
 
 #if 0
 #define IPRINTF(x)     printf x
@@ -133,11 +133,20 @@
        panic("npxdna vector not initialized");
 }
 
+static int
+npxdna_empty(struct proc *p)
+{
+
+       /* raise a DNA TRAP, math_emulate would take over eventually */
+       IPRINTF(("Emul"));
+       return 0; 
+}
+
 int    (*npxdna_func)(struct proc *) = npxdna_notset;
 
-int    npxdna_s87(struct proc *);
+static int     npxdna_s87(struct proc *);
 #ifdef I686_CPU
-int    npxdna_xmm(struct proc *);
+static int     npxdna_xmm(struct proc *);
 #endif /* I686_CPU */
 void   npxexit(void);
 
@@ -250,6 +259,11 @@
        idt[16].gd = save_idt_npxtrap;
        write_eflags(save_eflags);
 
+       if (rv == NPX_NONE) {
+               /* No FPU. Handle it here, npxattach won't be called */
+               npxdna_func = npxdna_empty;
+       }
+
        return (rv);
 }
 
@@ -446,7 +460,7 @@
  * saved state.
  */
 #ifdef I686_CPU
-int
+static int
 npxdna_xmm(struct proc *p)
 {
 
@@ -485,15 +499,10 @@
 }
 #endif /* I686_CPU */
 
-int
+static int
 npxdna_s87(struct proc *p)
 {
 
-       if (npx_type == NPX_NONE) {
-               IPRINTF(("Emul"));
-               return (0);
-       }
-
 #ifdef DIAGNOSTIC
        if (cpl != 0 || npx_nointr != 0)
                panic("npxdna: masked");



Home | Main Index | Thread Index | Old Index