summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/m88k/include/asm.h18
-rw-r--r--sys/arch/m88k/m88k/eh_common.S139
2 files changed, 78 insertions, 79 deletions
diff --git a/sys/arch/m88k/include/asm.h b/sys/arch/m88k/include/asm.h
index 2b8354a78fe..aa408898a03 100644
--- a/sys/arch/m88k/include/asm.h
+++ b/sys/arch/m88k/include/asm.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: asm.h,v 1.4 2005/04/27 21:12:44 miod Exp $ */
+/* $OpenBSD: asm.h,v 1.5 2005/04/30 16:46:49 miod Exp $ */
/*
* Mach Operating System
@@ -167,22 +167,6 @@
#define RTE NOP ; rte
/*
- * Useful in some situations.
- */
-#define CALL(NAME, ARG1, ARG2) \
- or r2, r0, ARG1; \
- bsr.n NAME; \
- or r3, r0, ARG2
-
-/* This define is similar to CALL, but accepts a function pointer XXX smurph */
-#define CALLP(NAME, ARG1, ARG2) \
- or.u r5, r0, hi16(NAME); \
- ld r4, r5, lo16(NAME); \
- or r2, r0, ARG1; \
- jsr.n r4; \
- or r3, r0, ARG2
-
-/*
* Fields in cr18. More bits are used privately in the exception handling
* code.
*/
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S
index 4fd814090bb..7ac59c0c979 100644
--- a/sys/arch/m88k/m88k/eh_common.S
+++ b/sys/arch/m88k/m88k/eh_common.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: eh_common.S,v 1.9 2005/04/27 21:12:46 miod Exp $ */
+/* $OpenBSD: eh_common.S,v 1.10 2005/04/30 16:46:51 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -235,6 +235,12 @@
#define REG_OFF(reg_num) ((reg_num) * 4) /* (num * sizeof(register_t)) */
#define GENREG_OFF(num) (REG_OFF(EF_R0 + (num))) /* GENeral REGister OFFset */
+/* Invoke a C function with 2 arguments */
+#define CALL(NAME, ARG1, ARG2) \
+ or r2, r0, ARG1; \
+ bsr.n _C_LABEL(NAME); \
+ or r3, r0, ARG2
+
/*
* Some registers used during the setting up of the new exception frame.
* Don't choose r1, r30, or r31 for any of them.
@@ -333,7 +339,7 @@
*
* ASGLOBAL(foo_handler)
* PREP88100("foo", 11, SSBR_Stuff, Precheck_Stuff)
- * CALL(_C_LABEL(trapXXX), T_FOO_FAULT, r31)
+ * CALL(trapXXX, T_FOO_FAULT, r31)
* DONE88100
*
* This defines the exception handler for the "foo" exception.
@@ -424,19 +430,19 @@
/* unknown exception handler */
GLOBAL(unknown_handler)
PREP88100("unknown", 0,,)
- CALL(_C_LABEL(m88100_trap), T_UNKNOWNFLT, r30)
+ CALL(m88100_trap, T_UNKNOWNFLT, r30)
DONE88100
/* interrupt exception handler */
GLOBAL(interrupt_handler)
PREP88100("interrupt", 1,,)
- CALL(_C_LABEL(m88100_trap), T_INT, r30)
+ CALL(m88100_trap, T_INT, r30)
DONE88100
/* instruction access exception handler */
GLOBAL(instruction_access_handler)
PREP88100("inst", 2,,)
- CALL(_C_LABEL(m88100_trap), T_INSTFLT, r30)
+ CALL(m88100_trap, T_INSTFLT, r30)
DONE88100
/*
@@ -451,13 +457,13 @@ GLOBAL(data_exception_handler)
/* misaligned access exception handler */
GLOBAL(misaligned_handler)
PREP88100("misalign", 4, Clear_SSBR_Dest,)
- CALL(_C_LABEL(m88100_trap), T_MISALGNFLT, r30)
+ CALL(m88100_trap, T_MISALGNFLT, r30)
DONE88100
/* unimplemented opcode exception handler */
GLOBAL(unimplemented_handler)
PREP88100("unimp", 5,,)
- CALL(_C_LABEL(m88100_trap), T_ILLFLT, r30)
+ CALL(m88100_trap, T_ILLFLT, r30)
DONE88100
/*
@@ -472,25 +478,25 @@ GLOBAL(privilege_handler)
ldcr r1, SR2 /* restore r1 */
RTE
1: PREP88100("privilege", 6, Clear_SSBR_Dest,)
- CALL(_C_LABEL(m88100_trap), T_PRIVINFLT, r30)
+ CALL(m88100_trap, T_PRIVINFLT, r30)
DONE88100
/* bounds checking exception handler */
GLOBAL(bounds_handler)
PREP88100("bounds", 7, Clear_SSBR_Dest,)
- CALL(_C_LABEL(m88100_trap), T_BNDFLT, r30)
+ CALL(m88100_trap, T_BNDFLT, r30)
DONE88100
/* integer divide-by-zero exception handler */
GLOBAL(divide_handler)
PREP88100("divide", 8, Clear_SSBR_Dest,)
- CALL(_C_LABEL(m88100_trap), T_ZERODIV, r30)
+ CALL(m88100_trap, T_ZERODIV, r30)
DONE88100
/* integer overflow exception handler */
GLOBAL(overflow_handler)
PREP88100("overflow", 9,,)
- CALL(_C_LABEL(m88100_trap), T_OVFFLT, r30)
+ CALL(m88100_trap, T_OVFFLT, r30)
DONE88100
/* Floating-point precise handler */
@@ -498,7 +504,8 @@ GLOBAL(overflow_handler)
bsr _ASM_LABEL(clear_FPp_ssbr_bit)
GLOBAL(fp_precise_handler)
PREP88100("FPU precise", 114, FPp_SSBR_STUFF,)
- CALL(_ASM_LABEL(m88100_Xfp_precise), r0, r30)
+ bsr.n _ASM_LABEL(m88100_Xfp_precise)
+ or r3, r0, r30
DONE88100
/* Floating-point imprecise handler */
@@ -506,14 +513,16 @@ GLOBAL(fp_precise_handler)
bsr _ASM_LABEL(clear_FPi_ssbr_bit)
GLOBAL(fp_imprecise_handler)
PREP88100("FPU imprecise", 115, FPi_SSBR_STUFF,)
- CALL(_ASM_LABEL(Xfp_imprecise), r0, r30)
+ bsr.n _ASM_LABEL(Xfp_imprecise)
+ or r3, r0, r30
DONE88100
/* trap 450: system calls */
GLOBAL(syscall_handler)
PREP88100("syscall", 450,,)
- ld r13, r30, GENREG_OFF(13)
- CALL(_C_LABEL(m88100_syscall), r13, r30)
+ ld r2, r30, GENREG_OFF(13)
+ bsr.n _C_LABEL(m88100_syscall)
+ or r3, r0, r30
DONE88100
/* trap 451: cache flush (necessary for trampolines) */
@@ -526,59 +535,60 @@ GLOBAL(cache_flush_handler)
/* trap 496: BUG system calls */
GLOBAL(bugtrap)
PREP88100("bugsyscall", 496,,)
- ld r9, r30, GENREG_OFF(9)
- CALL(_C_LABEL(bugsyscall), r9, r30)
+ ld r2, r30, GENREG_OFF(9)
+ bsr.n _C_LABEL(bugsyscall)
+ or r3, r0, r30
DONE88100
GLOBAL(sigsys)
PREP88100("sigsys", 501,,)
- CALL(_C_LABEL(m88100_trap), T_SIGSYS, r30)
+ CALL(m88100_trap, T_SIGSYS, r30)
DONE88100
GLOBAL(sigtrap)
PREP88100("sigtrap", 510,,)
- CALL(_C_LABEL(m88100_trap), T_SIGTRAP, r30)
+ CALL(m88100_trap, T_SIGTRAP, r30)
DONE88100
GLOBAL(stepbpt)
PREP88100("stepbpt", 504,,)
- CALL(_C_LABEL(m88100_trap), T_STEPBPT, r30)
+ CALL(m88100_trap, T_STEPBPT, r30)
DONE88100
GLOBAL(userbpt)
PREP88100("userbpt", 511,,)
- CALL(_C_LABEL(m88100_trap), T_USERBPT, r30)
+ CALL(m88100_trap, T_USERBPT, r30)
DONE88100
#ifdef DDB
GLOBAL(break)
PREP88100("break", 130,,)
- CALL(_C_LABEL(m88100_trap), T_KDB_BREAK, r30)
+ CALL(m88100_trap, T_KDB_BREAK, r30)
DONE88100
GLOBAL(trace)
PREP88100("trace", 131,,)
- CALL(_C_LABEL(m88100_trap), T_KDB_TRACE, r30)
+ CALL(m88100_trap, T_KDB_TRACE, r30)
DONE88100
GLOBAL(entry)
PREP88100("kdb", 132,,)
- CALL(_C_LABEL(m88100_trap), T_KDB_ENTRY, r30)
+ CALL(m88100_trap, T_KDB_ENTRY, r30)
DONE88100
#else
GLOBAL(break)
PREP88100("break", 130,,)
- CALL(_C_LABEL(m88100_trap), T_UNKNOWNFLT, r30)
+ CALL(m88100_trap, T_UNKNOWNFLT, r30)
DONE88100
GLOBAL(trace)
PREP88100("trace", 131,,)
- CALL(_C_LABEL(m88100_trap), T_UNKNOWNFLT, r30)
+ CALL(m88100_trap, T_UNKNOWNFLT, r30)
DONE88100
GLOBAL(entry)
PREP88100("unknown", 132,,)
- CALL(_C_LABEL(m88100_trap), T_UNKNOWNFLT, r30)
+ CALL(m88100_trap, T_UNKNOWNFLT, r30)
DONE88100
#endif
@@ -719,7 +729,8 @@ GLOBAL(reset_handler)
st r20, r31, 0x00
#endif
- CALL(_C_LABEL(error_fatal), r30, r30)
+ bsr.n _C_LABEL(error_fatal)
+ or r2, r0, r30
/* turn interrupts back on */
ldcr r1, PSR
@@ -1568,7 +1579,7 @@ ASLOCAL(m88100_fpu_enable)
* register, say r15. R14 is in use (see return_to_... below).
*/
or r15, r0, r30
- CALL(_C_LABEL(m88100_trap), T_DATAFLT, r15)
+ CALL(m88100_trap, T_DATAFLT, r15)
or r30, r0, r15
8:
@@ -1660,7 +1671,7 @@ ASLOCAL(m88100_return_code)
FLUSH_PIPELINE
1:
- CALL(_C_LABEL(m88100_trap), T_DATAFLT, r30)
+ CALL(m88100_trap, T_DATAFLT, r30)
#ifdef M88110
br _ASM_LABEL(check_ast)
#else
@@ -1714,14 +1725,14 @@ ASLOCAL(check_ast)
bb0 eq, r2, 2f
#endif
#if defined(M88110)
- CALL(_C_LABEL(m88110_trap), T_ASTFLT, FPTR)
+ CALL(m88110_trap, T_ASTFLT, FPTR)
#endif
#if defined(M88110) && defined(M88100)
br no_ast
2:
#endif
#ifdef M88100
- CALL(_C_LABEL(m88100_trap), T_ASTFLT, FPTR)
+ CALL(m88100_trap, T_ASTFLT, FPTR)
#endif
ASLOCAL(no_ast)
@@ -1825,19 +1836,19 @@ ASLOCAL(no_ast)
/* unknown exception handler */
GLOBAL(m88110_unknown_handler)
PREP88110("unknown", 0,)
- CALL(_C_LABEL(m88110_trap), T_UNKNOWNFLT, r30)
+ CALL(m88110_trap, T_UNKNOWNFLT, r30)
DONE88110
/* interrupt exception handler */
GLOBAL(m88110_interrupt_handler)
PREP88110("interrupt", 1,)
- CALL(_C_LABEL(m88110_trap), T_INT, r30)
+ CALL(m88110_trap, T_INT, r30)
DONE88110
/* instruction access exception handler */
GLOBAL(m88110_instruction_access_handler)
PREP88110("inst", 2,)
- CALL(_C_LABEL(m88110_trap), T_INSTFLT, r30)
+ CALL(m88110_trap, T_INSTFLT, r30)
DONE88110
/*
* data access exception handler --
@@ -1845,25 +1856,25 @@ GLOBAL(m88110_instruction_access_handler)
*/
GLOBAL(m88110_data_exception_handler)
PREP88110("data", 3, M88110_Data_Precheck)
- CALL(_C_LABEL(m88110_trap), T_DATAFLT, r30)
+ CALL(m88110_trap, T_DATAFLT, r30)
DONE88110
/* misaligned access exception handler */
GLOBAL(m88110_misaligned_handler)
PREP88110("misalign", 4,)
- CALL(_C_LABEL(m88110_trap), T_MISALGNFLT, r30)
+ CALL(m88110_trap, T_MISALGNFLT, r30)
DONE88110
/* unimplemented opcode exception handler */
GLOBAL(m88110_unimplemented_handler)
PREP88110("unimp", 5,)
- CALL(_C_LABEL(m88110_trap), T_ILLFLT, r30)
+ CALL(m88110_trap, T_ILLFLT, r30)
DONE88110
/* privilege exception handler */
GLOBAL(m88110_privilege_handler)
PREP88110("privilege", 6,)
- CALL(_C_LABEL(m88110_trap), T_PRIVINFLT, r30)
+ CALL(m88110_trap, T_PRIVINFLT, r30)
DONE88110
/*
@@ -1872,56 +1883,58 @@ GLOBAL(m88110_privilege_handler)
*/
GLOBAL(m88110_bounds_handler)
PREP88110("bounds", 7,)
- CALL(_C_LABEL(m88110_trap), T_BNDFLT, r30)
+ CALL(m88110_trap, T_BNDFLT, r30)
DONE88110
/* integer divide-by-zero exception handler */
GLOBAL(m88110_divide_handler)
PREP88110("divide", 8,)
- CALL(_C_LABEL(m88110_trap), T_ZERODIV, r30)
+ CALL(m88110_trap, T_ZERODIV, r30)
DONE88110
/* integer overflow exception handler */
GLOBAL(m88110_overflow_handler)
PREP88110("overflow", 9,)
- CALL(_C_LABEL(m88110_trap), T_OVFFLT, r30)
+ CALL(m88110_trap, T_OVFFLT, r30)
DONE88110
/* Floating-point precise handler */
GLOBAL(m88110_fp_precise_handler)
PREP88110("FPU precise", 114,)
- CALL(_ASM_LABEL(m88110_Xfp_precise), r0, r30)
+ bsr.n _ASM_LABEL(m88110_Xfp_precise)
+ or r3, r0, r30
DONE88110
/* MVME197 non-maskable interrupt handler (ABORT button) */
GLOBAL(m88110_nonmaskable)
PREP88110("MVME197 non-mask", 11,)
- CALL(_C_LABEL(m88110_trap), T_NON_MASK, r30)
+ CALL(m88110_trap, T_NON_MASK, r30)
DONE88110
/* MVME197 data MMU read miss handler */
GLOBAL(m88110_data_read_miss)
PREP88110("MVME197 read miss", 12,)
- CALL(_C_LABEL(m88110_trap), T_197_READ, r30)
+ CALL(m88110_trap, T_197_READ, r30)
DONE88110
/* MVME197 data MMU write miss handler */
GLOBAL(m88110_data_write_miss)
PREP88110("MVME197 write miss", 13,)
- CALL(_C_LABEL(m88110_trap), T_197_WRITE, r30)
+ CALL(m88110_trap, T_197_WRITE, r30)
DONE88110
/* MVME197 inst MMU ATC miss handler */
GLOBAL(m88110_inst_atc_miss)
PREP88110("MVME197 inst miss", 14,)
- CALL(_C_LABEL(m88110_trap), T_197_INST, r30)
+ CALL(m88110_trap, T_197_INST, r30)
DONE88110
/* trap 450: system calls */
GLOBAL(m88110_syscall_handler)
PREP88110("syscall", 450,)
- ld r13, r30, GENREG_OFF(13)
- CALL(_C_LABEL(m88110_syscall), r13, r30)
+ ld r2, r30, GENREG_OFF(13)
+ bsr.n _C_LABEL(m88110_syscall)
+ or r3, r0, r30
DONE88110
/* trap 451: cache flush (necessary for trampolines) */
@@ -1934,59 +1947,60 @@ GLOBAL(m88110_cache_flush_handler)
/* trap 496: BUG system calls */
GLOBAL(m88110_bugtrap)
PREP88110("bugsyscall", 496,)
- ld r9, r30, GENREG_OFF(9)
- CALL(_C_LABEL(bugsyscall), r9, r30)
+ ld r2, r30, GENREG_OFF(9)
+ bsr.n _C_LABEL(bugsyscall)
+ or r3, r0, r30
DONE88110
GLOBAL(m88110_sigsys)
PREP88110("sigsys", 501,)
- CALL(_C_LABEL(m88110_trap), T_SIGSYS, r30)
+ CALL(m88110_trap, T_SIGSYS, r30)
DONE88110
GLOBAL(m88110_sigtrap)
PREP88110("sigtrap", 510,)
- CALL(_C_LABEL(m88110_trap), T_SIGTRAP, r30)
+ CALL(m88110_trap, T_SIGTRAP, r30)
DONE88110
GLOBAL(m88110_stepbpt)
PREP88110("stepbpt", 504,)
- CALL(_C_LABEL(m88110_trap), T_STEPBPT, r30)
+ CALL(m88110_trap, T_STEPBPT, r30)
DONE88110
GLOBAL(m88110_userbpt)
PREP88110("userbpt", 511,)
- CALL(_C_LABEL(m88110_trap), T_USERBPT, r30)
+ CALL(m88110_trap, T_USERBPT, r30)
DONE88110
#ifdef DDB
GLOBAL(m88110_break)
PREP88110("break", 130,)
- CALL(_C_LABEL(m88110_trap), T_KDB_BREAK, r30)
+ CALL(m88110_trap, T_KDB_BREAK, r30)
DONE88110
GLOBAL(m88110_trace)
PREP88110("trace", 131,)
- CALL(_C_LABEL(m88110_trap), T_KDB_TRACE, r30)
+ CALL(m88110_trap, T_KDB_TRACE, r30)
DONE88110
GLOBAL(m88110_entry)
PREP88110("kdb", 132,)
- CALL(_C_LABEL(m88110_trap), T_KDB_ENTRY, r30)
+ CALL(m88110_trap, T_KDB_ENTRY, r30)
DONE88110
#else
GLOBAL(m88110_break)
PREP88110("break", 130,)
- CALL(_C_LABEL(m88110_trap), T_UNKNOWNFLT, r30)
+ CALL(m88110_trap, T_UNKNOWNFLT, r30)
DONE88110
GLOBAL(m88110_trace)
PREP88110("trace", 131,)
- CALL(_C_LABEL(m88110_trap), T_UNKNOWNFLT, r30)
+ CALL(m88110_trap, T_UNKNOWNFLT, r30)
DONE88110
GLOBAL(m88110_entry)
PREP88110("unknown", 132,)
- CALL(_C_LABEL(m88110_trap), T_UNKNOWNFLT, r30)
+ CALL(m88110_trap, T_UNKNOWNFLT, r30)
DONE88110
#endif
@@ -2146,7 +2160,8 @@ GLOBAL(m88110_reset_handler)
st r20, r31, 0x00
#endif
- CALL(_C_LABEL(error_fatal), r30, r30)
+ bsr.n _C_LABEL(error_fatal)
+ or r2, r0, r30
/* turn interrupts back on */
ldcr r1, PSR