From 7ae0ceacbd790042fc8fd8c57ceb9f029a9f7063 Mon Sep 17 00:00:00 2001 From: wollman Date: Fri, 9 Sep 1994 23:13:03 +0000 Subject: [PATCH] Define new MIB variable, hw.floatingpoint, which is true if FP hardware is present, and false if an emulator is being used. --- sys/amd64/amd64/fpu.c | 7 ++++--- sys/amd64/isa/npx.c | 7 ++++--- sys/i386/isa/npx.c | 7 ++++--- sys/kern/kern_sysctl.c | 5 ++++- sys/sys/sysctl.h | 6 ++++-- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index f7f9b27f9c75..fcc31ba52998 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.9 1994/06/11 05:17:15 davidg Exp $ + * $Id: npx.c,v 1.10 1994/08/13 03:50:11 wollman Exp $ */ #include "npx.h" @@ -119,6 +119,7 @@ struct proc *npxproc; static bool_t npx_ex16; static bool_t npx_exists; +int hw_float; static struct gate_descriptor npx_idt_probeintr; static int npx_intrno; static volatile u_int npx_intrs_while_probing; @@ -266,7 +267,7 @@ npxprobe1(dvp) control = 0x5a5a; fnstcw(&control); if ((control & 0x1f3f) == 0x033f) { - npx_exists = 1; + hw_float = npx_exists = 1; /* * We have an npx, now divide by 0 to see if exception * 16 works. @@ -323,7 +324,7 @@ npxattach(dvp) if (!npx_ex16 && !npx_irq13) { if (npx_exists) { printf("npx%d: Error reporting broken, using 387 emulator\n",dvp->id_unit); - npx_exists = 0; + hw_float = npx_exists = 0; } else { printf("npx%d: 387 Emulator\n",dvp->id_unit); } diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c index f7f9b27f9c75..fcc31ba52998 100644 --- a/sys/amd64/isa/npx.c +++ b/sys/amd64/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.9 1994/06/11 05:17:15 davidg Exp $ + * $Id: npx.c,v 1.10 1994/08/13 03:50:11 wollman Exp $ */ #include "npx.h" @@ -119,6 +119,7 @@ struct proc *npxproc; static bool_t npx_ex16; static bool_t npx_exists; +int hw_float; static struct gate_descriptor npx_idt_probeintr; static int npx_intrno; static volatile u_int npx_intrs_while_probing; @@ -266,7 +267,7 @@ npxprobe1(dvp) control = 0x5a5a; fnstcw(&control); if ((control & 0x1f3f) == 0x033f) { - npx_exists = 1; + hw_float = npx_exists = 1; /* * We have an npx, now divide by 0 to see if exception * 16 works. @@ -323,7 +324,7 @@ npxattach(dvp) if (!npx_ex16 && !npx_irq13) { if (npx_exists) { printf("npx%d: Error reporting broken, using 387 emulator\n",dvp->id_unit); - npx_exists = 0; + hw_float = npx_exists = 0; } else { printf("npx%d: 387 Emulator\n",dvp->id_unit); } diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index f7f9b27f9c75..fcc31ba52998 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.9 1994/06/11 05:17:15 davidg Exp $ + * $Id: npx.c,v 1.10 1994/08/13 03:50:11 wollman Exp $ */ #include "npx.h" @@ -119,6 +119,7 @@ struct proc *npxproc; static bool_t npx_ex16; static bool_t npx_exists; +int hw_float; static struct gate_descriptor npx_idt_probeintr; static int npx_intrno; static volatile u_int npx_intrs_while_probing; @@ -266,7 +267,7 @@ npxprobe1(dvp) control = 0x5a5a; fnstcw(&control); if ((control & 0x1f3f) == 0x033f) { - npx_exists = 1; + hw_float = npx_exists = 1; /* * We have an npx, now divide by 0 to see if exception * 16 works. @@ -323,7 +324,7 @@ npxattach(dvp) if (!npx_ex16 && !npx_irq13) { if (npx_exists) { printf("npx%d: Error reporting broken, using 387 emulator\n",dvp->id_unit); - npx_exists = 0; + hw_float = npx_exists = 0; } else { printf("npx%d: 387 Emulator\n",dvp->id_unit); } diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 63e8dd632aa6..47bd274e1950 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 - * $Id: kern_sysctl.c,v 1.7 1994/08/10 06:25:02 wollman Exp $ + * $Id: kern_sysctl.c,v 1.8 1994/08/18 22:35:04 wollman Exp $ */ /* @@ -309,6 +309,7 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) struct proc *p; { extern char machine[], cpu_model[]; + extern int hw_float; /* all sysctl names at this level are terminal */ if (namelen != 1) @@ -330,6 +331,8 @@ hw_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) ctob(physmem - cnt.v_wire_count))); case HW_PAGESIZE: return (sysctl_rdint(oldp, oldlenp, newp, PAGE_SIZE)); + case HW_FLOATINGPT: + return (sysctl_rdint(oldp, oldlenp, newp, hw_float)); default: return (EOPNOTSUPP); } diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index acad92526dd9..c92149607154 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $Id: sysctl.h,v 1.4 1994/08/08 15:41:08 wollman Exp $ + * $Id: sysctl.h,v 1.5 1994/08/10 06:25:07 wollman Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -224,7 +224,8 @@ struct kinfo_proc { #define HW_PAGESIZE 7 /* int: software page size */ #define HW_DISKNAMES 8 /* strings: disk drive names */ #define HW_DISKSTATS 9 /* struct: diskstats[] */ -#define HW_MAXID 10 /* number of valid hw ids */ +#define HW_FLOATINGPT 10 /* int: has HW floating point? */ +#define HW_MAXID 11 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ @@ -237,6 +238,7 @@ struct kinfo_proc { { "pagesize", CTLTYPE_INT }, \ { "disknames", CTLTYPE_STRUCT }, \ { "diskstats", CTLTYPE_STRUCT }, \ + { "floatingpoint", CTLTYPE_INT }, \ } /*