Define new MIB variable, hw.floatingpoint, which is true if FP hardware

is present, and false if an emulator is being used.
This commit is contained in:
wollman 1994-09-09 23:13:03 +00:00
parent 7ae6d81d71
commit 7ae0ceacbd
5 changed files with 20 additions and 12 deletions

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 }, \
}
/*