diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-08 14:03:36 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-05-08 14:03:36 +0000 |
commit | ac5c8692e0df20716a5d9f9bf5c5218fa0b8dff4 (patch) | |
tree | f5178f09efda927b517fd9786aa4fc499341e2c7 /sys | |
parent | 9ef8006bfb0efa3753205f60b8ec197299f26bef (diff) |
Clean the internal m88k trap type codes; while there, simplify and
factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/luna88k/include/locore.h | 3 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 56 | ||||
-rw-r--r-- | sys/arch/m88k/include/asm.h | 6 | ||||
-rw-r--r-- | sys/arch/m88k/include/db_machdep.h | 6 | ||||
-rw-r--r-- | sys/arch/m88k/include/trap.h | 55 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 54 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88k_machdep.c | 74 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 31 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/vectors_88100.S | 63 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/vectors_88110.S | 55 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/locore.h | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m88110.c | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 100 |
14 files changed, 204 insertions, 310 deletions
diff --git a/sys/arch/luna88k/include/locore.h b/sys/arch/luna88k/include/locore.h index 00d85fab2c1..35d2442e99e 100644 --- a/sys/arch/luna88k/include/locore.h +++ b/sys/arch/luna88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.7 2005/12/03 16:52:14 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.8 2006/05/08 14:03:34 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -21,7 +21,6 @@ void set_cpu_number(cpuid_t); /* eh.S */ void sigsys(void); -void sigtrap(void); void stepbpt(void); void userbpt(void); void syscall_handler(void); diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index fa7aa4db21f..5cfd9f0228a 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.30 2005/12/11 21:36:04 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.31 2006/05/08 14:03:34 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -104,10 +104,6 @@ #include <ddb/db_output.h> /* db_printf() */ #endif /* DDB */ -typedef struct { - unsigned word_one, word_two; -} m88k_exception_vector_area; - caddr_t allocsys(caddr_t); void consinit(void); void dumpconf(void); @@ -121,7 +117,6 @@ void savectx(struct pcb *); void setlevel(unsigned int); void slave_pre_main(void); int slave_main(void); -void vector_init(m88k_exception_vector_area *, unsigned *); vaddr_t size_memory(void); void powerdown(void); @@ -1319,55 +1314,6 @@ nvram_by_symbol(symbol) return value; } -#define SIGSYS_MAX 501 -#define SIGTRAP_MAX 510 - -#define EMPTY_BR 0xc0000000 /* empty "br" instruction */ -#define NO_OP 0xf4005800 /* "or r0, r0, r0" */ - -#define BRANCH(FROM, TO) \ - (EMPTY_BR | ((unsigned)(TO) - (unsigned)(FROM)) >> 2) - -#define SET_VECTOR(NUM, VALUE) \ - do { \ - vector[NUM].word_one = NO_OP; \ - vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ - } while (0) - -/* - * vector_init(vector, vector_init_list) - * - * This routine sets up the m88k vector table for the running processor. - * It is called with a very little stack, and interrupts disabled, - * so don't call any other functions! - */ -void -vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) -{ - unsigned num; - unsigned vec; - - for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; - num++) { - if (vec != UNKNOWN_HANDLER) - SET_VECTOR(num, vec); - } - - for (; num <= SIGSYS_MAX; num++) - SET_VECTOR(num, sigsys); - - for (; num <= SIGTRAP_MAX; num++) - SET_VECTOR(num, sigtrap); - - SET_VECTOR(450, syscall_handler); - SET_VECTOR(451, cache_flush_handler); - SET_VECTOR(504, stepbpt); - SET_VECTOR(511, userbpt); - - /* GCC will by default produce explicit trap 503 for division by zero */ - SET_VECTOR(503, vector_init_list[T_ZERODIV]); -} - /* * return next safe spl to reenable interrupts. */ diff --git a/sys/arch/m88k/include/asm.h b/sys/arch/m88k/include/asm.h index 536699246b4..39d7f25b651 100644 --- a/sys/arch/m88k/include/asm.h +++ b/sys/arch/m88k/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.7 2005/12/03 14:30:05 miod Exp $ */ +/* $OpenBSD: asm.h,v 1.8 2006/05/08 14:03:34 miod Exp $ */ /* * Mach Operating System @@ -201,10 +201,6 @@ #define DMT_DREG_OFFSET 7 #define DMT_DREG_WIDTH 5 -/* exception vector marker */ -#define UNKNOWN_HANDLER 0xffffffff -#define END_OF_VECTOR_LIST 0xfffffffe - #endif /* _KERNEL */ #endif /* __M88K_ASM_H__ */ diff --git a/sys/arch/m88k/include/db_machdep.h b/sys/arch/m88k/include/db_machdep.h index 99ef457d89e..1b0d690da46 100644 --- a/sys/arch/m88k/include/db_machdep.h +++ b/sys/arch/m88k/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.9 2006/05/03 18:14:51 miod Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.10 2006/05/08 14:03:34 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -98,11 +98,7 @@ void m88k_print_instruction(int, u_int, u_int32_t); /* db_disasm.c */ /* breakpoint/watchpoint foo */ #define IS_BREAKPOINT_TRAP(type,code) ((type)==T_KDB_BREAK) -#if 0 -#define IS_WATCHPOINT_TRAP(type,code) ((type)==T_KDB_WATCH) -#else #define IS_WATCHPOINT_TRAP(type,code) 0 -#endif /* T_WATCHPOINT */ /* machine specific commands have been added to ddb */ #define DB_MACHINE_COMMANDS diff --git a/sys/arch/m88k/include/trap.h b/sys/arch/m88k/include/trap.h index bd7984e6fd9..0fda5f005b3 100644 --- a/sys/arch/m88k/include/trap.h +++ b/sys/arch/m88k/include/trap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.h,v 1.2 2005/04/27 14:09:45 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.3 2006/05/08 14:03:34 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -34,36 +34,29 @@ * Trap type values */ -#define T_RESADFLT 0 /* reserved addressing fault */ -#define T_PRIVINFLT 1 /* privileged instruction fault */ -#define T_RESOPFLT 2 /* reserved operand fault */ -#define T_INSTFLT 3 /* instruction access exception */ -#define T_DATAFLT 4 /* data access exception */ -#define T_MISALGNFLT 5 /* misaligned access exception */ -#define T_ILLFLT 6 /* unimplemented opcode exception */ -#define T_BNDFLT 7 /* bounds check violation exception */ -#define T_ZERODIV 8 /* illegal divide exception */ -#define T_OVFFLT 9 /* integer overflow exception */ -#define T_ERRORFLT 10 /* error exception */ -#define T_FPEPFLT 11 /* floating point precise exception */ -#define T_FPEIFLT 12 /* floating point imprecise exception */ -#define T_ASTFLT 13 /* software trap */ -#define T_KDB_ENTRY 14 /* force entry to kernel debugger */ -#define T_KDB_BREAK 15 /* break point hit */ -#define T_KDB_TRACE 16 /* trace */ -#define T_UNKNOWNFLT 17 /* unknown exception */ -#define T_SIGTRAP 18 /* generate SIGTRAP */ -#define T_SIGSYS 19 /* generate SIGSYS */ -#define T_STEPBPT 20 /* special breakpoint for single step */ -#define T_USERBPT 21 /* user set breakpoint (for debugger) */ -#define T_SYSCALL 22 /* Syscall */ -#define T_NON_MASK 23 /* MVME197 Non-Maskable Interrupt */ -#define T_KDB_WATCH 24 /* watchpoint hit */ -#define T_197_READ 25 /* MVME197 Data Read Miss (Software Table Searches) */ -#define T_197_WRITE 26 /* MVME197 Data Write Miss (Software Table Searches) */ -#define T_197_INST 27 /* MVME197 Inst ATC Miss (Software Table Searches) */ -#define T_INT 28 /* interrupt exception */ -#define T_USER 29 /* user mode fault */ +#define T_PRIVINFLT 0 /* privileged instruction fault */ +#define T_INSTFLT 1 /* instruction access exception */ +#define T_DATAFLT 2 /* data access exception */ +#define T_MISALGNFLT 3 /* misaligned access exception */ +#define T_ILLFLT 4 /* unimplemented opcode exception */ +#define T_BNDFLT 5 /* bounds check violation exception */ +#define T_ZERODIV 6 /* illegal divide exception */ +#define T_OVFFLT 7 /* integer overflow exception */ +#define T_FPEPFLT 8 /* floating point precise exception */ +#define T_ASTFLT 9 /* software trap */ +#define T_KDB_ENTRY 10 /* force entry to kernel debugger */ +#define T_KDB_BREAK 11 /* break point hit */ +#define T_KDB_TRACE 12 /* trace */ +#define T_UNKNOWNFLT 13 /* unknown exception */ +#define T_SIGSYS 14 /* generate SIGSYS */ +#define T_STEPBPT 15 /* special breakpoint for single step */ +#define T_USERBPT 16 /* user set breakpoint (for debugger) */ +#define T_INT 17 /* interrupt exception */ +#define T_NON_MASK 18 /* MVME197 Non-Maskable Interrupt */ +#define T_110_DRM 19 /* 88110 data read miss (sw table walk) */ +#define T_110_DWM 20 /* 88110 data write miss (sw table walk) */ +#define T_110_IAM 21 /* 88110 inst ATC miss (sw table walk) */ +#define T_USER 22 /* user mode fault */ #ifndef _LOCORE void cache_flush(struct trapframe *); diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index 868707dae99..87a87beb0a5 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.16 2005/12/11 21:45:30 miod Exp $ */ +/* $OpenBSD: eh_common.S,v 1.17 2006/05/08 14:03:34 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -532,11 +532,6 @@ GLOBAL(sigsys) CALL(m88100_trap, T_SIGSYS, r30) DONE88100 -GLOBAL(sigtrap) - PREP88100("sigtrap", 510,,) - CALL(m88100_trap, T_SIGTRAP, r30) - DONE88100 - GLOBAL(stepbpt) PREP88100("stepbpt", 504,,) CALL(m88100_trap, T_STEPBPT, r30) @@ -562,21 +557,6 @@ GLOBAL(entry) PREP88100("kdb", 132,,) CALL(m88100_trap, T_KDB_ENTRY, r30) DONE88100 -#else -GLOBAL(break) - PREP88100("break", 130,,) - CALL(m88100_trap, T_UNKNOWNFLT, r30) - DONE88100 - -GLOBAL(trace) - PREP88100("trace", 131,,) - CALL(m88100_trap, T_UNKNOWNFLT, r30) - DONE88100 - -GLOBAL(entry) - PREP88100("unknown", 132,,) - CALL(m88100_trap, T_UNKNOWNFLT, r30) - DONE88100 #endif /* @@ -1909,20 +1889,20 @@ GLOBAL(m88110_nonmaskable) /* MVME197 data MMU read miss handler */ GLOBAL(m88110_data_read_miss) - PREP88110("MVME197 read miss", 12,) - CALL(m88110_trap, T_197_READ, r30) + PREP88110("MVME197 data read miss", 12,) + CALL(m88110_trap, T_110_DRM, r30) DONE88110 /* MVME197 data MMU write miss handler */ GLOBAL(m88110_data_write_miss) - PREP88110("MVME197 write miss", 13,) - CALL(m88110_trap, T_197_WRITE, r30) + PREP88110("MVME197 data write miss", 13,) + CALL(m88110_trap, T_110_DRM, r30) DONE88110 /* MVME197 inst MMU ATC miss handler */ GLOBAL(m88110_inst_atc_miss) - PREP88110("MVME197 inst miss", 14,) - CALL(m88110_trap, T_197_INST, r30) + PREP88110("MVME197 inst ATC miss", 14,) + CALL(m88110_trap, T_110_IAM, r30) DONE88110 /* trap 450: system calls */ @@ -1945,11 +1925,6 @@ GLOBAL(m88110_sigsys) CALL(m88110_trap, T_SIGSYS, r30) DONE88110 -GLOBAL(m88110_sigtrap) - PREP88110("sigtrap", 510,) - CALL(m88110_trap, T_SIGTRAP, r30) - DONE88110 - GLOBAL(m88110_stepbpt) PREP88110("stepbpt", 504,) CALL(m88110_trap, T_STEPBPT, r30) @@ -1975,21 +1950,6 @@ GLOBAL(m88110_entry) PREP88110("kdb", 132,) CALL(m88110_trap, T_KDB_ENTRY, r30) DONE88110 -#else -GLOBAL(m88110_break) - PREP88110("break", 130,) - CALL(m88110_trap, T_UNKNOWNFLT, r30) - DONE88110 - -GLOBAL(m88110_trace) - PREP88110("trace", 131,) - CALL(m88110_trap, T_UNKNOWNFLT, r30) - DONE88110 - -GLOBAL(m88110_entry) - PREP88110("unknown", 132,) - CALL(m88110_trap, T_UNKNOWNFLT, r30) - DONE88110 #endif /* diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c index 5b248b9eee6..c067076682f 100644 --- a/sys/arch/m88k/m88k/m88k_machdep.c +++ b/sys/arch/m88k/m88k/m88k_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88k_machdep.c,v 1.14 2006/04/15 15:43:33 miod Exp $ */ +/* $OpenBSD: m88k_machdep.c,v 1.15 2006/05/08 14:03:34 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -54,6 +54,7 @@ #include <sys/errno.h> #include <sys/lock.h> +#include <machine/asm.h> #include <machine/asm_macro.h> #include <machine/cmmu.h> #include <machine/cpu.h> @@ -73,10 +74,15 @@ #include <ddb/db_interface.h> #endif /* DDB */ +typedef struct { + u_int32_t word_one, word_two; +} m88k_exception_vector_area; + void dosoftint(void); void dumpconf(void); void dumpsys(void); void regdump(struct trapframe *f); +void vector_init(m88k_exception_vector_area *, u_int32_t *); /* * CMMU and CPU variables @@ -402,3 +408,69 @@ spl0() setipl(0); return (s); } + +#define EMPTY_BR 0xc0000000 /* empty "br" instruction */ +#define NO_OP 0xf4005800 /* "or r0, r0, r0" */ + +#define BRANCH(FROM, TO) \ + (EMPTY_BR | ((vaddr_t)(TO) - (vaddr_t)(FROM)) >> 2) + +#define SET_VECTOR(NUM, VALUE) \ + do { \ + vbr[NUM].word_one = NO_OP; \ + vbr[NUM].word_two = BRANCH(&vbr[NUM].word_two, VALUE); \ + } while (0) + +/* + * vector_init(vector, vector_init_list) + * + * This routine sets up the m88k vector table for the running processor. + * This is the first C code to run, before anything is initialized. + * + * It fills the exception vectors page. I would add an extra four bytes + * to the page pointed to by the vbr, since the 88100 may execute the + * first instruction of the next trap handler, as documented in its + * Errata. Processing trap #511 would then fall into the next page, + * unless the address computation wraps, or software traps can not trigger + * the issue - the Errata does not provide more detail. And since the + * MVME BUG does not add an extra NOP after their VBR page, I'll assume this + * is safe for now -- miod + */ +void +vector_init(m88k_exception_vector_area *vbr, u_int32_t *vector_init_list) +{ + u_int num; + u_int32_t vec; + + for (num = 0; (vec = vector_init_list[num]) != 0; num++) + SET_VECTOR(num, vec); + + switch (cputyp) { + default: +#ifdef M88110 + case CPU_88110: + for (; num < 512; num++) + SET_VECTOR(num, m88110_sigsys); + + SET_VECTOR(450, m88110_syscall_handler); + SET_VECTOR(451, m88110_cache_flush_handler); + SET_VECTOR(504, m88110_stepbpt); + SET_VECTOR(511, m88110_userbpt); + break; +#endif +#ifdef M88100 + case CPU_88100: + for (; num < 512; num++) + SET_VECTOR(num, sigsys); + + SET_VECTOR(450, syscall_handler); + SET_VECTOR(451, cache_flush_handler); + SET_VECTOR(504, stepbpt); + SET_VECTOR(511, userbpt); + break; +#endif + } + + /* GCC will by default produce explicit trap 503 for division by zero */ + SET_VECTOR(503, vector_init_list[8]); +} diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index 0b91d2a5bec..447ce117862 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.31 2006/05/04 19:38:45 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.32 2006/05/08 14:03:35 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -488,16 +488,11 @@ user_fault: fault_type = FPE_INTOVF; break; case T_FPEPFLT+T_USER: - case T_FPEIFLT+T_USER: sig = SIGFPE; break; case T_SIGSYS+T_USER: sig = SIGSYS; break; - case T_SIGTRAP+T_USER: - sig = SIGTRAP; - fault_type = TRAP_TRACE; - break; case T_STEPBPT+T_USER: #ifdef PTRACE /* @@ -641,24 +636,31 @@ m88110_trap(unsigned type, struct trapframe *frame) break; /*NOTREACHED*/ - case T_197_READ+T_USER: - case T_197_READ: + case T_110_DRM+T_USER: + case T_110_DRM: +#ifdef DEBUG printf("DMMU read miss: Hardware Table Searches should be enabled!\n"); +#endif panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ - case T_197_WRITE+T_USER: - case T_197_WRITE: + case T_110_DWM+T_USER: + case T_110_DWM: +#ifdef DEBUG printf("DMMU write miss: Hardware Table Searches should be enabled!\n"); +#endif panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ - case T_197_INST+T_USER: - case T_197_INST: + case T_110_IAM+T_USER: + case T_110_IAM: +#ifdef DEBUG printf("IMMU miss: Hardware Table Searches should be enabled!\n"); +#endif panictrap(frame->tf_vector, frame); break; /*NOTREACHED*/ + #ifdef DDB case T_KDB_TRACE: s = splhigh(); @@ -1010,16 +1012,11 @@ m88110_user_fault: fault_type = FPE_INTOVF; break; case T_FPEPFLT+T_USER: - case T_FPEIFLT+T_USER: sig = SIGFPE; break; case T_SIGSYS+T_USER: sig = SIGSYS; break; - case T_SIGTRAP+T_USER: - sig = SIGTRAP; - fault_type = TRAP_TRACE; - break; case T_STEPBPT+T_USER: #ifdef PTRACE /* diff --git a/sys/arch/m88k/m88k/vectors_88100.S b/sys/arch/m88k/m88k/vectors_88100.S index 959925f9814..b1019a8a58c 100644 --- a/sys/arch/m88k/m88k/vectors_88100.S +++ b/sys/arch/m88k/m88k/vectors_88100.S @@ -1,4 +1,4 @@ -/* $OpenBSD: vectors_88100.S,v 1.2 2004/07/02 08:32:07 miod Exp $ */ +/* $OpenBSD: vectors_88100.S,v 1.3 2006/05/08 14:03:35 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1991, 1992 Carnegie Mellon University @@ -28,15 +28,15 @@ #include <machine/asm.h> -#define UNDEFINED16 \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; +#define UNKNOWN16 \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); \ + VECTOR(unknown_handler); VECTOR(unknown_handler); data GLOBAL(vector_list) @@ -51,38 +51,39 @@ GLOBAL(vector_list) VECTOR(divide_handler) /* 08 */ VECTOR(overflow_handler) /* 09 */ VECTOR(error_handler) /* 0a */ - word UNKNOWN_HANDLER /* 0b */ - word UNKNOWN_HANDLER /* 0c */ - word UNKNOWN_HANDLER /* 0d */ - word UNKNOWN_HANDLER /* 0e */ - word UNKNOWN_HANDLER /* 0f */ - UNDEFINED16 /* 1x */ - UNDEFINED16 /* 2x */ - UNDEFINED16 /* 3x */ - UNDEFINED16 /* 4x */ - UNDEFINED16 /* 5x */ - UNDEFINED16 /* 6x */ - word UNKNOWN_HANDLER /* 70 */ - word UNKNOWN_HANDLER /* 71 */ + VECTOR(unknown_handler) /* 0b */ + VECTOR(unknown_handler) /* 0c */ + VECTOR(unknown_handler) /* 0d */ + VECTOR(unknown_handler) /* 0e */ + VECTOR(unknown_handler) /* 0f */ + UNKNOWN16 /* 1x */ + UNKNOWN16 /* 2x */ + UNKNOWN16 /* 3x */ + UNKNOWN16 /* 4x */ + UNKNOWN16 /* 5x */ + UNKNOWN16 /* 6x */ + VECTOR(unknown_handler) /* 70 */ + VECTOR(unknown_handler) /* 71 */ VECTOR(fp_precise_handler) /* 72 */ VECTOR(fp_imprecise_handler) /* 73 */ VECTOR(unimplemented_handler) /* 74 */ - word UNKNOWN_HANDLER /* 75 */ + VECTOR(unknown_handler) /* 75 */ VECTOR(unimplemented_handler) /* 76 */ - word UNKNOWN_HANDLER /* 77 */ + VECTOR(unknown_handler) /* 77 */ VECTOR(unimplemented_handler) /* 78 */ - word UNKNOWN_HANDLER /* 79 */ + VECTOR(unknown_handler) /* 79 */ VECTOR(unimplemented_handler) /* 7a */ - word UNKNOWN_HANDLER /* 7b */ + VECTOR(unknown_handler) /* 7b */ VECTOR(unimplemented_handler) /* 7c */ - word UNKNOWN_HANDLER /* 7d */ + VECTOR(unknown_handler) /* 7d */ VECTOR(unimplemented_handler) /* 7e */ - word UNKNOWN_HANDLER /* 7f */ + VECTOR(unknown_handler) /* 7f */ VECTOR(syscall_handler) /* 80 */ VECTOR(syscall_handler) /* 81 */ +#ifdef DDB VECTOR(break) /* 82 */ VECTOR(trace) /* 83 */ VECTOR(entry) /* 84 */ -GLOBAL(vector_list_end) - word END_OF_VECTOR_LIST +#endif + word 0 diff --git a/sys/arch/m88k/m88k/vectors_88110.S b/sys/arch/m88k/m88k/vectors_88110.S index 6b6ac29a9f5..df0535a34b9 100644 --- a/sys/arch/m88k/m88k/vectors_88110.S +++ b/sys/arch/m88k/m88k/vectors_88110.S @@ -1,4 +1,4 @@ -/* $OpenBSD: vectors_88110.S,v 1.2 2004/07/02 08:32:07 miod Exp $ */ +/* $OpenBSD: vectors_88110.S,v 1.3 2006/05/08 14:03:35 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1991, 1992 Carnegie Mellon University @@ -28,15 +28,15 @@ #include <machine/asm.h> -#define UNDEFINED16 \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; \ - word UNKNOWN_HANDLER; word UNKNOWN_HANDLER; +#define UNKNOWN16 \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); \ + VECTOR(m88110_unknown_handler); VECTOR(m88110_unknown_handler); data GLOBAL(m88110_vector_list) @@ -56,32 +56,33 @@ GLOBAL(m88110_vector_list) VECTOR(m88110_data_write_miss) /* 0d */ VECTOR(m88110_inst_atc_miss) /* 0e */ VECTOR(m88110_trace) /* 0f */ - UNDEFINED16 /* 1x */ - UNDEFINED16 /* 2x */ - UNDEFINED16 /* 3x */ - UNDEFINED16 /* 4x */ - UNDEFINED16 /* 5x */ - UNDEFINED16 /* 6x */ - word UNKNOWN_HANDLER /* 70 */ - word UNKNOWN_HANDLER /* 71 */ + UNKNOWN16 /* 1x */ + UNKNOWN16 /* 2x */ + UNKNOWN16 /* 3x */ + UNKNOWN16 /* 4x */ + UNKNOWN16 /* 5x */ + UNKNOWN16 /* 6x */ + VECTOR(m88110_unknown_handler) /* 70 */ + VECTOR(m88110_unknown_handler) /* 71 */ VECTOR(m88110_fp_precise_handler) /* 72 */ - word UNKNOWN_HANDLER /* 73 */ + VECTOR(m88110_unknown_handler) /* 73 */ VECTOR(m88110_unimplemented_handler) /* 74 */ - word UNKNOWN_HANDLER /* 75 */ + VECTOR(m88110_unknown_handler) /* 75 */ VECTOR(m88110_unimplemented_handler) /* 76 */ - word UNKNOWN_HANDLER /* 77 */ + VECTOR(m88110_unknown_handler) /* 77 */ VECTOR(m88110_unimplemented_handler) /* 78 */ - word UNKNOWN_HANDLER /* 79 */ + VECTOR(m88110_unknown_handler) /* 79 */ VECTOR(m88110_unimplemented_handler) /* 7a */ - word UNKNOWN_HANDLER /* 7b */ + VECTOR(m88110_unknown_handler) /* 7b */ VECTOR(m88110_unimplemented_handler) /* 7c */ - word UNKNOWN_HANDLER /* 7d */ + VECTOR(m88110_unknown_handler) /* 7d */ VECTOR(m88110_unimplemented_handler) /* 7e */ - word UNKNOWN_HANDLER /* 7f */ + VECTOR(m88110_unknown_handler) /* 7f */ VECTOR(m88110_syscall_handler) /* 80 */ VECTOR(m88110_syscall_handler) /* 81 */ +#ifdef DDB VECTOR(m88110_break) /* 82 */ VECTOR(m88110_trace) /* 83 */ VECTOR(m88110_entry) /* 84 */ -GLOBAL(m88110_vector_list_end) - word END_OF_VECTOR_LIST +#endif + word 0 diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index c1fc400f090..7b54c5bad32 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.31 2006/04/13 21:16:15 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.32 2006/05/08 14:03:35 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -23,13 +23,11 @@ void set_cpu_number(cpuid_t); /* eh.S */ void sigsys(void); -void sigtrap(void); void stepbpt(void); void userbpt(void); void syscall_handler(void); void cache_flush_handler(void); void m88110_sigsys(void); -void m88110_sigtrap(void); void m88110_stepbpt(void); void m88110_userbpt(void); void m88110_syscall_handler(void); diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 542e327dff5..980804454bc 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.48 2006/05/06 22:16:28 miod Exp $ */ +/* $OpenBSD: locore.S,v 1.49 2006/05/08 14:03:35 miod Exp $ */ /* * Copyright (c) 2005, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -229,7 +229,7 @@ ASLOCAL(main_start) or r3, r3, lo16(_C_LABEL(vector_list)) #endif /* M88100 */ 2: - bsr.n _C_LABEL(vector_init) + bsr.n _C_LABEL(mvme88k_vector_init) ldcr r2, VBR /* diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c index 227b2f26665..726a54d8531 100644 --- a/sys/arch/mvme88k/mvme88k/m88110.c +++ b/sys/arch/mvme88k/mvme88k/m88110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.c,v 1.35 2005/12/11 21:45:31 miod Exp $ */ +/* $OpenBSD: m88110.c,v 1.36 2006/05/08 14:03:35 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * All rights reserved. @@ -70,7 +70,6 @@ #include <machine/m88110.h> #include <machine/m88410.h> #include <machine/psl.h> -#include <machine/trap.h> #include <mvme88k/dev/busswreg.h> diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index b543e266b2a..b58ac09f147 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.181 2006/05/02 21:43:09 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.182 2006/05/08 14:03:35 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -75,7 +75,6 @@ #include <machine/kcore.h> #include <machine/locore.h> #include <machine/reg.h> -#include <machine/trap.h> #include <dev/cons.h> @@ -89,10 +88,6 @@ #include <ddb/db_var.h> #endif /* DDB */ -typedef struct { - unsigned word_one, word_two; -} m88k_exception_vector_area; - caddr_t allocsys(caddr_t); void consinit(void); void dumpconf(void); @@ -100,10 +95,10 @@ void dumpsys(void); int getcpuspeed(struct mvmeprom_brdid *); void identifycpu(void); void mvme_bootstrap(void); +void mvme88k_vector_init(u_int32_t *, u_int32_t *); void savectx(struct pcb *); void secondary_main(void); void secondary_pre_main(void); -void vector_init(m88k_exception_vector_area *, unsigned *); void _doboot(void); extern void setlevel(unsigned int); @@ -1164,81 +1159,6 @@ bootcnputc(dev, c) bugoutchr(c); } -#define SIGSYS_MAX 501 -#define SIGTRAP_MAX 510 - -#define EMPTY_BR 0xc0000000 /* empty "br" instruction */ -#define NO_OP 0xf4005800 /* "or r0, r0, r0" */ - -#define BRANCH(FROM, TO) \ - (EMPTY_BR | ((vaddr_t)(TO) - (vaddr_t)(FROM)) >> 2) - -#define SET_VECTOR(NUM, VALUE) \ - do { \ - vector[NUM].word_one = NO_OP; \ - vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ - } while (0) - -/* - * vector_init(vector, vector_init_list) - * - * This routine sets up the m88k vector table for the running processor. - * It is called with a very little stack, and interrupts disabled, - * so don't call any other functions! - */ -void -vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) -{ - unsigned num; - unsigned vec; - - for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; - num++) { - if (vec != UNKNOWN_HANDLER) - SET_VECTOR(num, vec); - } - - /* Save BUG vector */ - bugvec[0] = vector[MVMEPROM_VECTOR].word_one; - bugvec[1] = vector[MVMEPROM_VECTOR].word_two; - -#ifdef M88110 - if (CPU_IS88110) { - for (; num <= SIGSYS_MAX; num++) - SET_VECTOR(num, m88110_sigsys); - - for (; num <= SIGTRAP_MAX; num++) - SET_VECTOR(num, m88110_sigtrap); - - SET_VECTOR(450, m88110_syscall_handler); - SET_VECTOR(451, m88110_cache_flush_handler); - SET_VECTOR(504, m88110_stepbpt); - SET_VECTOR(511, m88110_userbpt); - } -#endif -#ifdef M88100 - if (CPU_IS88100) { - for (; num <= SIGSYS_MAX; num++) - SET_VECTOR(num, sigsys); - - for (; num <= SIGTRAP_MAX; num++) - SET_VECTOR(num, sigtrap); - - SET_VECTOR(450, syscall_handler); - SET_VECTOR(451, cache_flush_handler); - SET_VECTOR(504, stepbpt); - SET_VECTOR(511, userbpt); - } -#endif - - /* GCC will by default produce explicit trap 503 for division by zero */ - SET_VECTOR(503, vector_init_list[T_ZERODIV]); - - /* Save new BUG vector */ - sysbugvec[0] = vector[MVMEPROM_VECTOR].word_one; - sysbugvec[1] = vector[MVMEPROM_VECTOR].word_two; -} - unsigned getipl(void) { @@ -1287,3 +1207,19 @@ raiseipl(unsigned level) set_psr(psr); return curspl; } + +void +mvme88k_vector_init(u_int32_t *vbr, u_int32_t *vectors) +{ + extern void vector_init(u_int32_t *, u_int32_t *); /* gross */ + + /* Save BUG vector */ + bugvec[0] = vbr[MVMEPROM_VECTOR * 2 + 0]; + bugvec[1] = vbr[MVMEPROM_VECTOR * 2 + 1]; + + vector_init(vbr, vectors); + + /* Save new BUG vector */ + sysbugvec[0] = vbr[MVMEPROM_VECTOR * 2 + 0]; + sysbugvec[1] = vbr[MVMEPROM_VECTOR * 2 + 1]; +} |