diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-08-22 11:23:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-08-22 11:23:07 +0000 |
commit | cfd592f5faad574e259b5cafea01226e4e039d2b (patch) | |
tree | 9dcad5e24788d367e0042d7d7b7a561e14d6034d /sys/arch | |
parent | b3e8a9a0da9a4fbe3a84d9d3113851474129d460 (diff) |
To workaround an early 88100 models problem, gcc explicitely adds checks for
division by zero in the generated code, and will trap to vector #503 in this
case.
Make sure that this vector gets handled as the regular divide-by-zero vector.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore_c_routines.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c index d89fb45d25e..fc9a14f1e02 100644 --- a/sys/arch/mvme88k/mvme88k/locore_c_routines.c +++ b/sys/arch/mvme88k/mvme88k/locore_c_routines.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore_c_routines.c,v 1.29 2003/08/10 21:34:20 miod Exp $ */ +/* $OpenBSD: locore_c_routines.c,v 1.30 2003/08/22 11:23:06 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -38,6 +38,7 @@ #include <machine/asm_macro.h> /* enable/disable interrupts */ #include <machine/cpu_number.h> /* cpu_number() */ #include <machine/locore.h> +#include <machine/trap.h> #ifdef M88100 #include <machine/m88100.h> /* DMT_VALID */ #endif @@ -303,7 +304,7 @@ data_access_emulation(unsigned *eframe) #define BRANCH(FROM, TO) (EMPTY_BR | ((unsigned)(TO) - (unsigned)(FROM)) >> 2) -#define SET_VECTOR(NUM, to, VALUE) { \ +#define SET_VECTOR(NUM, VALUE) { \ vector[NUM].word_one = NO_OP; \ vector[NUM].word_two = BRANCH(&vector[NUM].word_two, VALUE); \ } @@ -323,7 +324,7 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) for (num = 0; (vec = vector_init_list[num]) != END_OF_VECTOR_LIST; num++) { if (vec != UNKNOWN_HANDLER) - SET_VECTOR(num, to, vec); + SET_VECTOR(num, vec); __asm__ (NOP_STRING); __asm__ (NOP_STRING); __asm__ (NOP_STRING); @@ -334,43 +335,46 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) #ifdef M88110 case CPU_88110: while (num < 496) { - SET_VECTOR(num, to, m88110_sigsys); + SET_VECTOR(num, m88110_sigsys); num++; } num++; /* skip 496, BUG ROM vector */ - SET_VECTOR(450, to, m88110_syscall_handler); + SET_VECTOR(450, m88110_syscall_handler); while (num <= SIGSYS_MAX) - SET_VECTOR(num++, to, m88110_sigsys); + SET_VECTOR(num++, m88110_sigsys); while (num <= SIGTRAP_MAX) - SET_VECTOR(num++, to, m88110_sigtrap); + SET_VECTOR(num++, m88110_sigtrap); - SET_VECTOR(504, to, m88110_stepbpt); - SET_VECTOR(511, to, m88110_userbpt); + SET_VECTOR(504, m88110_stepbpt); + SET_VECTOR(511, m88110_userbpt); break; #endif /* M88110 */ #ifdef M88100 case CPU_88100: while (num < 496) { - SET_VECTOR(num, to, sigsys); + SET_VECTOR(num, sigsys); num++; } num++; /* skip 496, BUG ROM vector */ - SET_VECTOR(450, to, syscall_handler); + SET_VECTOR(450, syscall_handler); while (num <= SIGSYS_MAX) - SET_VECTOR(num++, to, sigsys); + SET_VECTOR(num++, sigsys); while (num <= SIGTRAP_MAX) - SET_VECTOR(num++, to, sigtrap); + SET_VECTOR(num++, sigtrap); - SET_VECTOR(504, to, stepbpt); - SET_VECTOR(511, to, userbpt); + SET_VECTOR(504, stepbpt); + SET_VECTOR(511, userbpt); break; #endif /* M88100 */ } + + /* GCC will by default produce explicit trap 503 for division by zero */ + SET_VECTOR(503, vector_init_list[T_ZERODIV]); } #ifdef MVME188 |