summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-11-22 23:08:50 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-11-22 23:08:50 +0000
commit93c78fad24fed6979660dabfd3a34607f8dd8032 (patch)
tree5641bd1aa437f642dd761d2f17aefcef706be8fc
parent277ac738ec7e1e1a203752243cd518c895799000 (diff)
new sysctl: machdep.v8mul says whether the kernel replaced the mul/div/rem
stubs, so that userland can do the same. we cannot just determine based on sun4m, because cypress (at least) is a sun4m cpu without the instructions
-rw-r--r--sys/arch/sparc/include/cpu.h6
-rw-r--r--sys/arch/sparc/sparc/cpu.c4
-rw-r--r--sys/arch/sparc/sparc/machdep.c5
3 files changed, 11 insertions, 4 deletions
diff --git a/sys/arch/sparc/include/cpu.h b/sys/arch/sparc/include/cpu.h
index c33a70c9581..13bd4e05c00 100644
--- a/sys/arch/sparc/include/cpu.h
+++ b/sys/arch/sparc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.18 2002/08/12 16:35:38 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.19 2002/11/22 23:08:46 deraadt Exp $ */
/* $NetBSD: cpu.h,v 1.24 1997/03/15 22:25:15 pk Exp $ */
/*
@@ -54,13 +54,15 @@
#define CPU_LED_BLINK 1 /* int: twiddle the power LED */
/* 2 formerly int: vsyncblank */
#define CPU_CPUTYPE 3 /* int: cpu type */
-#define CPU_MAXID 4 /* 3 valid machdep IDs */
+#define CPU_V8MUL 4
+#define CPU_MAXID 5 /* 4 valid machdep IDs */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "led_blink", CTLTYPE_INT }, \
{ 0, 0 }, \
{ "cputype", CTLTYPE_INT }, \
+ { "v8mul", CTLTYPE_INT }, \
}
#ifdef _KERNEL
diff --git a/sys/arch/sparc/sparc/cpu.c b/sys/arch/sparc/sparc/cpu.c
index c32239bfdce..3dee51da295 100644
--- a/sys/arch/sparc/sparc/cpu.c
+++ b/sys/arch/sparc/sparc/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.37 2002/03/14 01:26:44 millert Exp $ */
+/* $OpenBSD: cpu.c,v 1.38 2002/11/22 23:08:49 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.56 1997/09/15 20:52:36 pk Exp $ */
/*
@@ -1339,6 +1339,7 @@ extern int _divreplace, _divreplace_end, _div;
extern int _udivreplace, _udivreplace_end, _udiv;
extern int _remreplace, _remreplace_end, _rem;
extern int _uremreplace, _uremreplace_end, _urem;
+int v8mul; /* flag whether cpu has hardware mul, div, and rem */
struct replace {
void *from, *frome, *to;
@@ -1366,4 +1367,5 @@ replacemul()
bcopy(ireplace[i].from, ireplace[i].to,
ireplace[i].frome - ireplace[i].from);
splx(s);
+ v8mul = 1;
}
diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c
index 1dfa5bb15cb..ae1d4243e55 100644
--- a/sys/arch/sparc/sparc/machdep.c
+++ b/sys/arch/sparc/sparc/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.88 2002/11/10 21:23:09 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.89 2002/11/22 23:08:49 deraadt Exp $ */
/* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */
/*
@@ -466,6 +466,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int oldval;
#endif
int ret;
+ extern int v8mul;
/* all sysctl names are this level are terminal */
if (namelen != 1)
@@ -500,6 +501,8 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
#endif
case CPU_CPUTYPE:
return (sysctl_rdint(oldp, oldlenp, newp, cputyp));
+ case CPU_V8MUL:
+ return (sysctl_rdint(oldp, oldlenp, newp, v8mul));
default:
return (EOPNOTSUPP);
}