summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-01-27 16:16:28 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-01-27 16:16:28 +0000
commite4e7fa53836f3e4df92922382229f61df1b0ac80 (patch)
treec55298d8549eaba1911db630b6e251a34a56a6d1 /sys/arch
parent95302659848f005f2a4cc00f3dc1347f0e791138 (diff)
Only install the fpsp exception vectors if the cpu is a 68040.
Thus, it becomes unnecessary to check for the cpu type in the exception handlers, saving a few cycles and a few bytes. Tested by various people on hp300, mac68k, mvme68k, 68040 and non-68040.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/hp300/hp300/machdep.c12
-rw-r--r--sys/arch/hp300/hp300/vectors.s43
-rw-r--r--sys/arch/m68k/fpsp/netbsd.sa57
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c10
-rw-r--r--sys/arch/mac68k/mac68k/vectors.s30
-rw-r--r--sys/arch/mvme68k/mvme68k/vectors.s12
6 files changed, 74 insertions, 90 deletions
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index 69df3b0204c..7eb640b7506 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.88 2003/12/20 20:08:16 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.89 2004/01/27 16:16:22 miod Exp $ */
/* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */
/*
@@ -515,6 +515,9 @@ identifycpu()
const char *t;
char mc, *td;
int len;
+#ifdef FPSP
+ extern u_long fpvect_tab, fpvect_end, fpsp_tab;
+#endif
/*
* Map machineid to model name.
@@ -678,6 +681,13 @@ identifycpu()
break;
}
+#ifdef FPSP
+ if (cputype == CPU_68040) {
+ bcopy(&fpsp_tab, &fpvect_tab,
+ (&fpvect_end - &fpvect_tab) * sizeof (fpvect_tab));
+ }
+#endif
+
return;
lose:
panic("startup");
diff --git a/sys/arch/hp300/hp300/vectors.s b/sys/arch/hp300/hp300/vectors.s
index eb90cac1ea0..9995a12ab3c 100644
--- a/sys/arch/hp300/hp300/vectors.s
+++ b/sys/arch/hp300/hp300/vectors.s
@@ -1,4 +1,4 @@
-| $OpenBSD: vectors.s,v 1.8 2003/06/04 22:08:14 deraadt Exp $
+| $OpenBSD: vectors.s,v 1.9 2004/01/27 16:16:22 miod Exp $
| $NetBSD: vectors.s,v 1.12 1997/07/14 19:18:32 thorpej Exp $
| Copyright (c) 1997 Jason R. Thorpe. All rights reserved.
@@ -98,23 +98,16 @@ GLOBAL(vectab)
VECTOR(illinst) /* 45: TRAP instruction vector */
VECTOR(illinst) /* 46: TRAP instruction vector */
VECTOR(trap15) /* 47: TRAP instruction vector */
-#ifdef FPSP
- ASVECTOR(bsun) /* 48: FPCP branch/set on unordered cond */
- ASVECTOR(inex) /* 49: FPCP inexact result */
- ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(unfl) /* 51: FPCP underflow */
- ASVECTOR(operr) /* 52: FPCP operand error */
- ASVECTOR(ovfl) /* 53: FPCP overflow */
- ASVECTOR(snan) /* 54: FPCP signalling NAN */
-#else
- VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
- VECTOR(fpfault) /* 49: FPCP inexact result */
- VECTOR(fpfault) /* 50: FPCP divide by zero */
- VECTOR(fpfault) /* 51: FPCP underflow */
- VECTOR(fpfault) /* 52: FPCP operand error */
- VECTOR(fpfault) /* 53: FPCP overflow */
- VECTOR(fpfault) /* 54: FPCP signalling NAN */
-#endif
+
+GLOBAL(fpvect_tab)
+ VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
+ VECTOR(fpfault) /* 49: FPCP inexact result */
+ VECTOR(fpfault) /* 50: FPCP divide by zero */
+ VECTOR(fpfault) /* 51: FPCP underflow */
+ VECTOR(fpfault) /* 52: FPCP operand error */
+ VECTOR(fpfault) /* 53: FPCP overflow */
+ VECTOR(fpfault) /* 54: FPCP signalling NAN */
+GLOBAL(fpvect_end)
VECTOR(fpunsupp) /* 55: FPCP unimplemented data type */
VECTOR(badtrap) /* 56: unassigned, reserved */
@@ -138,3 +131,17 @@ GLOBAL(vectab)
BADTRAP16 /* 64-255: user interrupt vectors */
BADTRAP16 /* 64-255: user interrupt vectors */
BADTRAP16 /* 64-255: user interrupt vectors */
+
+#ifdef FPSP
+ /*
+ * 68040: this chunk of vectors is copied into the fpfault zone
+ */
+GLOBAL(fpsp_tab)
+ ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
+ ASVECTOR(inex) /* 49: FPCP inexact result */
+ ASVECTOR(dz) /* 50: FPCP divide by zero */
+ ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
+ ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
+ ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
+ ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
+#endif /* FPSP */
diff --git a/sys/arch/m68k/fpsp/netbsd.sa b/sys/arch/m68k/fpsp/netbsd.sa
index 933bc0fff30..b473d4b9b2b 100644
--- a/sys/arch/m68k/fpsp/netbsd.sa
+++ b/sys/arch/m68k/fpsp/netbsd.sa
@@ -1,4 +1,4 @@
-* $OpenBSD: netbsd.sa,v 1.4 2001/09/20 17:02:30 mpech Exp $
+* $OpenBSD: netbsd.sa,v 1.5 2004/01/27 16:16:27 miod Exp $
* $NetBSD: netbsd.sa,v 1.3 1997/04/25 02:26:04 thorpej Exp $
* MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
@@ -77,7 +77,6 @@ SKELETON IDNT 2,1 Motorola 040 Floating Point Software Package
#include "../include/asm.h"
xref b1238_fix
- xref _C_LABEL(mmutype)
*
* Divide by Zero exception
@@ -85,11 +84,7 @@ SKELETON IDNT 2,1 Motorola 040 Floating Point Software Package
* All dz exceptions are 'real', hence no fpsp_dz entry point.
*
xdef dz
- xdef real_dz
dz:
- cmp.l #-2,_C_LABEL(mmutype)
- bne.l _C_LABEL(fpfault)
-real_dz:
link a6,#-LOCAL_SIZE
fsave -(sp)
bclr.b #E1,E_BYTE(a6)
@@ -121,8 +116,6 @@ real_dz:
xdef real_inex
xdef inex
inex:
- cmp.l #-2,_C_LABEL(mmutype)
- bne.l _C_LABEL(fpfault)
link a6,#-LOCAL_SIZE
fsave -(sp)
cmpi.b #VER_40,(sp) ;test version number
@@ -135,21 +128,21 @@ inex:
addq.l #4,sp
frestore (sp)+
unlk a6
- bra snan
+ bra fpsp_snan
inex_ckofl:
btst.b #ovfl_bit,2(sp) ;test for ovfl
beq inex_ckufl
addq.l #4,sp
frestore (sp)+
unlk a6
- bra ovfl
+ bra fpsp_ovfl
inex_ckufl:
btst.b #unfl_bit,2(sp) ;test for unfl
beq not_b1232
addq.l #4,sp
frestore (sp)+
unlk a6
- bra unfl
+ bra fpsp_unfl
*
* We do not have the bug 1232 case. Clean up the stack and call
@@ -186,13 +179,7 @@ inex_done:
*
* Overflow exception
*
- xref fpsp_ovfl
xdef real_ovfl
- xdef ovfl
-ovfl:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_ovfl
- jmp _C_LABEL(fpfault)
real_ovfl:
link a6,#-LOCAL_SIZE
fsave -(sp)
@@ -207,13 +194,7 @@ ovfl_done:
*
* Underflow exception
*
- xref fpsp_unfl
xdef real_unfl
- xdef unfl
-unfl:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_unfl
- jmp _C_LABEL(fpfault)
real_unfl:
link a6,#-LOCAL_SIZE
fsave -(sp)
@@ -228,13 +209,7 @@ unfl_done:
*
* Signalling NAN exception
*
- xref fpsp_snan
xdef real_snan
- xdef snan
-snan:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_snan
- jmp _C_LABEL(fpfault)
real_snan:
link a6,#-LOCAL_SIZE
fsave -(sp)
@@ -246,13 +221,7 @@ real_snan:
*
* Operand Error exception
*
- xref fpsp_operr
xdef real_operr
- xdef operr
-operr:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_operr
- jmp _C_LABEL(fpfault)
real_operr:
link a6,#-LOCAL_SIZE
fsave -(sp)
@@ -266,13 +235,7 @@ real_operr:
*
* This sample handler simply clears the nan bit in the FPSR.
*
- xref fpsp_bsun
xdef real_bsun
- xdef bsun
-bsun:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_bsun
- jmp _C_LABEL(fpfault)
real_bsun:
link a6,#-LOCAL_SIZE
fsave -(sp)
@@ -291,26 +254,14 @@ real_bsun:
* handle. E.g. an instruction with a co-processor ID that is not 1.
*
*
- xref fpsp_fline
xdef real_fline
- xdef fline
-fline:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_fline
- jmp _C_LABEL(fpfault)
real_fline:
jmp _C_LABEL(fpfault)
*
* Unsupported data type exception
*
- xref fpsp_unsupp
xdef real_unsupp
- xdef unsupp
-unsupp:
- cmp.l #-2,_C_LABEL(mmutype)
- beq.l fpsp_unsupp
- jmp _C_LABEL(fpfault)
real_unsupp:
link a6,#-LOCAL_SIZE
fsave -(sp)
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index bdeede84b01..6700d3bc7e0 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.109 2003/12/20 20:08:17 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.110 2004/01/27 16:16:27 miod Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -523,6 +523,9 @@ initcpu()
#ifdef M68040
void buserr40(void);
#endif
+#ifdef FPSP
+ extern u_long fpvect_tab, fpvect_end, fpsp_tab;
+#endif
switch (cputype) {
#ifdef M68060
@@ -535,11 +538,16 @@ initcpu()
case CPU_68040:
vectab[2] = buserr40;
vectab[3] = addrerr4060;
+#ifdef FPSP
+ bcopy(&fpsp_tab, &fpvect_tab,
+ (&fpvect_end - &fpvect_tab) * sizeof (fpvect_tab));
+#endif
break;
#endif
default:
break;
}
+
DCIS();
}
diff --git a/sys/arch/mac68k/mac68k/vectors.s b/sys/arch/mac68k/mac68k/vectors.s
index fe0dccc4301..6747505c8c7 100644
--- a/sys/arch/mac68k/mac68k/vectors.s
+++ b/sys/arch/mac68k/mac68k/vectors.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: vectors.s,v 1.5 2003/06/04 22:08:15 deraadt Exp $ */
+/* $OpenBSD: vectors.s,v 1.6 2004/01/27 16:16:27 miod Exp $ */
| $NetBSD: vectors.s,v 1.9 1997/09/03 06:16:24 scottr Exp $
| Copyright (c) 1988 University of Utah
@@ -96,15 +96,8 @@ GLOBAL(vectab)
VECTOR(illinst) /* 45: TRAP instruction vector */
VECTOR(illinst) /* 46: TRAP instruction vector */
VECTOR(trap15) /* 47: TRAP instruction vector */
-#ifdef FPSP
- ASVECTOR(bsun) /* 48: FPCP branch/set on unordered cond */
- ASVECTOR(inex) /* 49: FPCP inexact result */
- ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(unfl) /* 51: FPCP underflow */
- ASVECTOR(operr) /* 52: FPCP operand error */
- ASVECTOR(ovfl) /* 53: FPCP overflow */
- ASVECTOR(snan) /* 54: FPCP signalling NAN */
-#else
+
+GLOBAL(fpvect_tab)
VECTOR(fpfault) /* 48: FPCP branch/set on unordered cond */
VECTOR(fpfault) /* 49: FPCP inexact result */
VECTOR(fpfault) /* 50: FPCP divide by zero */
@@ -112,7 +105,8 @@ GLOBAL(vectab)
VECTOR(fpfault) /* 52: FPCP operand error */
VECTOR(fpfault) /* 53: FPCP overflow */
VECTOR(fpfault) /* 54: FPCP signalling NAN */
-#endif
+GLOBAL(fpvect_end)
+
VECTOR(fpunsupp) /* 55: FPCP unimplemented data type */
VECTOR(badtrap) /* 56: unassigned, reserved */
VECTOR(badtrap) /* 57: unassigned, reserved */
@@ -134,3 +128,17 @@ GLOBAL(vectab)
BADTRAP16 /* 64-255: user interrupt vectors */
BADTRAP16 /* 64-255: user interrupt vectors */
BADTRAP16 /* 64-255: user interrupt vectors */
+
+#ifdef FPSP
+ /*
+ * 68040: this chunk of vectors is copied into the fpfault zone
+ */
+GLOBAL(fpsp_tab)
+ ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
+ ASVECTOR(inex) /* 49: FPCP inexact result */
+ ASVECTOR(dz) /* 50: FPCP divide by zero */
+ ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
+ ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
+ ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
+ ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
+#endif /* FPSP */
diff --git a/sys/arch/mvme68k/mvme68k/vectors.s b/sys/arch/mvme68k/mvme68k/vectors.s
index 9ab6a215a82..3018f8e617e 100644
--- a/sys/arch/mvme68k/mvme68k/vectors.s
+++ b/sys/arch/mvme68k/mvme68k/vectors.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: vectors.s,v 1.8 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: vectors.s,v 1.9 2004/01/27 16:16:27 miod Exp $ */
| Copyright (c) 1995 Theo de Raadt
|
@@ -161,11 +161,11 @@ GLOBAL(fpvect_end)
* 68040: this chunk of vectors is copied into the fpfault zone
*/
GLOBAL(fpsp_tab)
- ASVECTOR(bsun) /* 48: FPCP branch/set on unordered cond */
+ ASVECTOR(fpsp_bsun) /* 48: FPCP branch/set on unordered cond */
ASVECTOR(inex) /* 49: FPCP inexact result */
ASVECTOR(dz) /* 50: FPCP divide by zero */
- ASVECTOR(unfl) /* 51: FPCP underflow */
- ASVECTOR(operr) /* 52: FPCP operand error */
- ASVECTOR(ovfl) /* 53: FPCP overflow */
- ASVECTOR(snan) /* 54: FPCP signalling NAN */
+ ASVECTOR(fpsp_unfl) /* 51: FPCP underflow */
+ ASVECTOR(fpsp_operr) /* 52: FPCP operand error */
+ ASVECTOR(fpsp_ovfl) /* 53: FPCP overflow */
+ ASVECTOR(fpsp_snan) /* 54: FPCP signalling NAN */
#endif /* FPSP */