diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-01 17:18:06 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2004-08-01 17:18:06 +0000 |
commit | 3ff16f986065e55c700fe254c2e867b24c5b9431 (patch) | |
tree | 174b6d62b4428905575ec0b2dfa9251d479c99d0 /sys | |
parent | af791ccb4611f1991b112519f0e3557de3ee628b (diff) |
Move 88100 DAE code to its own file, shared between luna88k and mvme88k.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/luna88k/include/locore.h | 26 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/locore_c_routines.c | 240 | ||||
-rw-r--r-- | sys/arch/m88k/conf/files.m88k | 3 | ||||
-rw-r--r-- | sys/arch/m88k/include/m88100.h | 24 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88100_machdep.c | 262 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/subr.S | 12 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/locore.h | 26 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore_c_routines.c | 241 |
8 files changed, 298 insertions, 536 deletions
diff --git a/sys/arch/luna88k/include/locore.h b/sys/arch/luna88k/include/locore.h index 2ad25d1b66f..d900fa3ab5f 100644 --- a/sys/arch/luna88k/include/locore.h +++ b/sys/arch/luna88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.2 2004/07/28 12:28:48 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.3 2004/08/01 17:18:02 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -9,26 +9,7 @@ * C prototypes for various routines defined in locore_* and friends */ -/* locore_asm_routines.S */ - -unsigned int do_load_word(vaddr_t address, - boolean_t supervisor_mode); -unsigned int do_load_half(vaddr_t address, - boolean_t supervisor_mode); -unsigned int do_load_byte(vaddr_t address, - boolean_t supervisor_mode); - -void do_store_word(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -void do_store_half(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -void do_store_byte(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); - -unsigned do_xmem_word(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -unsigned do_xmem_byte(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); +/* subr.S */ unsigned read_processor_identification_register(void); int badaddr(vaddr_t addr, int size); @@ -41,9 +22,6 @@ int guarded_access(unsigned char *volatile address, /* locore_c_routines.c */ -void dae_print(unsigned *eframe); -void data_access_emulation(unsigned *eframe); - unsigned getipl(void); /* machdep.c */ diff --git a/sys/arch/luna88k/luna88k/locore_c_routines.c b/sys/arch/luna88k/luna88k/locore_c_routines.c index bd65daae452..c2b1e04f792 100644 --- a/sys/arch/luna88k/luna88k/locore_c_routines.c +++ b/sys/arch/luna88k/luna88k/locore_c_routines.c @@ -1,4 +1,4 @@ -/* $OpenBSD: locore_c_routines.c,v 1.2 2004/07/22 18:58:02 miod Exp $ */ +/* $OpenBSD: locore_c_routines.c,v 1.3 2004/08/01 17:18:05 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -26,10 +26,7 @@ * rights to redistribute these changes. */ -#include "assym.h" - #include <sys/param.h> -#include <sys/types.h> #include <sys/systm.h> #include <machine/board.h> /* m188 bit defines */ @@ -39,9 +36,6 @@ #include <machine/cpu_number.h> /* cpu_number() */ #include <machine/locore.h> #include <machine/trap.h> -#ifdef M88100 -#include <machine/m88100.h> -#endif typedef struct { unsigned word_one, word_two; @@ -50,241 +44,9 @@ typedef struct { extern unsigned int *volatile int_mask_reg[MAX_CPUS]; /* in machdep.c */ extern unsigned master_cpu; /* in cmmu.c */ -/* FORWARDS */ void setlevel(unsigned int); void vector_init(m88k_exception_vector_area *, unsigned *); -#ifdef M88100 - -/* - * data access emulation for M88100 exceptions - */ - -#define DMT_BYTE 1 -#define DMT_HALF 2 -#define DMT_WORD 4 - -const struct { - unsigned char offset; - unsigned char size; -} dmt_en_info[16] = { - {0, 0}, {3, DMT_BYTE}, {2, DMT_BYTE}, {2, DMT_HALF}, - {1, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, - {0, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, - {0, DMT_HALF}, {0, 0}, {0, 0}, {0, DMT_WORD} -}; - -#ifdef DATA_DEBUG -int data_access_emulation_debug = 0; -#define DAE_DEBUG(stuff) \ - do { \ - if (data_access_emulation_debug != 0) { \ - stuff; \ - } \ - } while (0) -#else -#define DAE_DEBUG(stuff) -#endif - -void -dae_print(unsigned *eframe) -{ - int x; - unsigned dmax, dmdx, dmtx; - - if (!ISSET(eframe[EF_DMT0], DMT_VALID)) - return; - - for (x = 0; x < 3; x++) { - dmtx = eframe[EF_DMT0 + x * 3]; - if (!ISSET(dmtx, DMT_VALID)) - continue; - - dmdx = eframe[EF_DMD0 + x * 3]; - dmax = eframe[EF_DMA0 + x * 3]; - - if (ISSET(dmtx, DMT_WRITE)) - printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, - DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - else - printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', - DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - } -} - -void -data_access_emulation(unsigned *eframe) -{ - int x; - unsigned dmax, dmdx, dmtx; - unsigned v, reg; - - dmtx = eframe[EF_DMT0]; - if (!ISSET(dmtx, DMT_VALID)) - return; - - for (x = 0; x < 3; x++) { - dmtx = eframe[EF_DMT0 + x * 3]; - if (!ISSET(dmtx, DMT_VALID) || ISSET(dmtx, DMT_SKIP)) - continue; - - dmdx = eframe[EF_DMD0 + x * 3]; - dmax = eframe[EF_DMA0 + x * 3]; - - DAE_DEBUG( - if (ISSET(dmtx, DMT_WRITE)) - printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, - DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - else - printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', - DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem") - ); - - dmax += dmt_en_info[DMT_ENBITS(dmtx)].offset; - reg = DMT_DREGBITS(dmtx); - - if (!ISSET(dmtx, DMT_LOCKBAR)) { - /* the fault is not during an XMEM */ - - if (x == 2 && ISSET(dmtx, DMT_DOUB1)) { - /* pipeline 2 (earliest stage) for a double */ - - if (ISSET(dmtx, DMT_WRITE)) { - /* - * STORE DOUBLE WILL BE REINITIATED - * BY rte - */ - } else { - /* EMULATE ld.d INSTRUCTION */ - v = do_load_word(dmax, dmtx & DMT_DAS); - if (reg != 0) - eframe[EF_R0 + reg] = v; - v = do_load_word(dmax ^ 4, - dmtx & DMT_DAS); - if (reg != 31) - eframe[EF_R0 + reg + 1] = v; - } - } else { - /* not pipeline #2 with a double */ - if (dmtx & DMT_WRITE) { - switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { - case DMT_BYTE: - DAE_DEBUG( - printf("[byte %x -> [%x(%c)]\n", - dmdx & 0xff, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_byte(dmax, dmdx, - dmtx & DMT_DAS); - break; - case DMT_HALF: - DAE_DEBUG( - printf("[half %x -> [%x(%c)]\n", - dmdx & 0xffff, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_half(dmax, dmdx, - dmtx & DMT_DAS); - break; - case DMT_WORD: - DAE_DEBUG( - printf("[word %x -> [%x(%c)]\n", - dmdx, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_word(dmax, dmdx, - dmtx & DMT_DAS); - break; - } - } else { - /* else it's a read */ - switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { - case DMT_BYTE: - v = do_load_byte(dmax, - dmtx & DMT_DAS); - if (!ISSET(dmtx, DMT_SIGNED)) - v &= 0x000000ff; - break; - case DMT_HALF: - v = do_load_half(dmax, - dmtx & DMT_DAS); - if (!ISSET(dmtx, DMT_SIGNED)) - v &= 0x0000ffff; - break; - case DMT_WORD: - v = do_load_word(dmax, - dmtx & DMT_DAS); - break; - } - DAE_DEBUG( - if (reg == 0) - printf("[no write to r0 done]\n"); - else - printf("[r%d <- %x]\n", reg, v); - ); - if (reg != 0) - eframe[EF_R0 + reg] = v; - } - } - } else { - /* if lockbar is set... it's part of an XMEM */ - /* - * According to Motorola's "General Information", - * the DMT_DOUB1 bit is never set in this case, as it - * should be. - * If lockbar is set (as it is if we're here) and if - * the write is not set, then it's the same as if DOUB1 - * was set... - */ - if (!ISSET(dmtx, DMT_WRITE)) { - if (x != 2) { - /* RERUN xmem WITH DMD(x+1) */ - x++; - dmdx = eframe[EF_DMD0 + x * 3]; - } else { - /* RERUN xmem WITH DMD2 */ - } - - if (dmt_en_info[DMT_ENBITS(dmtx)].size == - DMT_WORD) { - v = do_xmem_word(dmax, dmdx, - dmtx & DMT_DAS); - } else { - v = do_xmem_byte(dmax, dmdx, - dmtx & DMT_DAS); - } - if (reg != 0) - eframe[EF_R0 + reg] = v; - } else { - if (x == 0) { - if (reg != 0) - eframe[EF_R0 + reg] = dmdx; - eframe[EF_SFIP] = eframe[EF_SNIP]; - eframe[EF_SNIP] = eframe[EF_SXIP]; - eframe[EF_SXIP] = 0; - /* xmem RERUN ON rte */ - eframe[EF_DMT0] = 0; - return; - } - } - } - } - eframe[EF_DMT0] = 0; -} -#endif /* M88100 */ - #define SIGSYS_MAX 501 #define SIGTRAP_MAX 510 diff --git a/sys/arch/m88k/conf/files.m88k b/sys/arch/m88k/conf/files.m88k index 83210d99d37..a849b4541e8 100644 --- a/sys/arch/m88k/conf/files.m88k +++ b/sys/arch/m88k/conf/files.m88k @@ -1,10 +1,11 @@ -# $OpenBSD: files.m88k,v 1.5 2004/07/25 11:06:42 miod Exp $ +# $OpenBSD: files.m88k,v 1.6 2004/08/01 17:18:05 miod Exp $ file arch/m88k/m88k/cmmu.c file arch/m88k/m88k/db_disasm.c ddb file arch/m88k/m88k/db_sstep.c ddb file arch/m88k/m88k/db_trace.c ddb file arch/m88k/m88k/m88100_fp.S m88100 +file arch/m88k/m88k/m88100_machdep.c m88100 file arch/m88k/m88k/m88110_fp.S m88110 file arch/m88k/m88k/m88110_mmu.S m88110 file arch/m88k/m88k/pmap.c diff --git a/sys/arch/m88k/include/m88100.h b/sys/arch/m88k/include/m88100.h index fbb587b74af..1b56d2f26d2 100644 --- a/sys/arch/m88k/include/m88100.h +++ b/sys/arch/m88k/include/m88100.h @@ -1,4 +1,4 @@ -/* $OpenBSD: m88100.h,v 1.1 2004/04/26 12:34:05 miod Exp $ */ +/* $OpenBSD: m88100.h,v 1.2 2004/08/01 17:18:05 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -25,8 +25,8 @@ * the rights to redistribute these changes. */ -#ifndef __MACHINE_M88100_H__ -#define __MACHINE_M88100_H__ +#ifndef __M88K_M88100_H__ +#define __M88K_M88100_H__ /* * 88100 RISC definitions @@ -56,4 +56,20 @@ #define DMT_DREGBITS(x) (((x) & DMT_DREG) >> DMT_DREGSHIFT) #define DMT_ENBITS(x) (((x) & DMT_EN) >> DMT_ENSHIFT) -#endif /* __MACHINE_M88100_H__ */ +#if defined(_KERNEL) && !defined(_LOCORE) +void dae_print(unsigned *eframe); +void data_access_emulation(unsigned *eframe); + +u_int32_t do_load_word(vaddr_t, int); +u_int16_t do_load_half(vaddr_t, int); +u_int8_t do_load_byte(vaddr_t, int); + +void do_store_word(vaddr_t, u_int32_t, int); +void do_store_half(vaddr_t, u_int16_t, int); +void do_store_byte(vaddr_t, u_int8_t, int); + +u_int32_t do_xmem_word(vaddr_t, u_int32_t, int); +u_int8_t do_xmem_byte(vaddr_t, u_int8_t, int); +#endif + +#endif /* __M88K_M88100_H__ */ diff --git a/sys/arch/m88k/m88k/m88100_machdep.c b/sys/arch/m88k/m88k/m88100_machdep.c new file mode 100644 index 00000000000..c0cbb795d4c --- /dev/null +++ b/sys/arch/m88k/m88k/m88100_machdep.c @@ -0,0 +1,262 @@ +/* $OpenBSD: m88100_machdep.c,v 1.1 2004/08/01 17:18:05 miod Exp $ */ +/* + * Mach Operating System + * Copyright (c) 1993-1991 Carnegie Mellon University + * Copyright (c) 1991 OMRON Corporation + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON AND OMRON ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON AND OMRON DISCLAIM ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include "assym.h" /* EF_xxx */ + +#include <sys/param.h> +#include <sys/systm.h> + +#include <m88k/m88100.h> + +/* + * data access emulation for M88100 exceptions + */ + +#define DMT_BYTE 1 +#define DMT_HALF 2 +#define DMT_WORD 4 + +const struct { + unsigned char offset; + unsigned char size; +} dmt_en_info[16] = { + {0, 0}, {3, DMT_BYTE}, {2, DMT_BYTE}, {2, DMT_HALF}, + {1, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, + {0, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, + {0, DMT_HALF}, {0, 0}, {0, 0}, {0, DMT_WORD} +}; + +#ifdef DATA_DEBUG +int data_access_emulation_debug = 0; +#define DAE_DEBUG(stuff) \ + do { \ + if (data_access_emulation_debug != 0) { \ + stuff; \ + } \ + } while (0) +#else +#define DAE_DEBUG(stuff) +#endif + +void +dae_print(unsigned *eframe) +{ + int x; + unsigned dmax, dmdx, dmtx; + + if (!ISSET(eframe[EF_DMT0], DMT_VALID)) + return; + + for (x = 0; x < 3; x++) { + dmtx = eframe[EF_DMT0 + x * 3]; + if (!ISSET(dmtx, DMT_VALID)) + continue; + + dmdx = eframe[EF_DMD0 + x * 3]; + dmax = eframe[EF_DMA0 + x * 3]; + + if (ISSET(dmtx, DMT_WRITE)) + printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", + x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, + DMT_ENBITS(dmtx), + dmtx & DMT_DOUB1 ? "double": "not double", + dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); + else + printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", + x, dmtx, dmtx & DMT_DAS ? 's' : 'u', + DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), + dmtx & DMT_DOUB1 ? "double": "not double", + dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); + } +} + +void +data_access_emulation(unsigned *eframe) +{ + int x; + unsigned dmax, dmdx, dmtx; + unsigned v, reg; + + dmtx = eframe[EF_DMT0]; + if (!ISSET(dmtx, DMT_VALID)) + return; + + for (x = 0; x < 3; x++) { + dmtx = eframe[EF_DMT0 + x * 3]; + if (!ISSET(dmtx, DMT_VALID) || ISSET(dmtx, DMT_SKIP)) + continue; + + dmdx = eframe[EF_DMD0 + x * 3]; + dmax = eframe[EF_DMA0 + x * 3]; + + DAE_DEBUG( + if (ISSET(dmtx, DMT_WRITE)) + printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", + x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, + DMT_ENBITS(dmtx), + dmtx & DMT_DOUB1 ? "double": "not double", + dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); + else + printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", + x, dmtx, dmtx & DMT_DAS ? 's' : 'u', + DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), + dmtx & DMT_DOUB1 ? "double": "not double", + dmtx & DMT_LOCKBAR ? "xmem": "not xmem") + ); + + dmax += dmt_en_info[DMT_ENBITS(dmtx)].offset; + reg = DMT_DREGBITS(dmtx); + + if (!ISSET(dmtx, DMT_LOCKBAR)) { + /* the fault is not during an XMEM */ + + if (x == 2 && ISSET(dmtx, DMT_DOUB1)) { + /* pipeline 2 (earliest stage) for a double */ + + if (ISSET(dmtx, DMT_WRITE)) { + /* + * STORE DOUBLE WILL BE REINITIATED + * BY rte + */ + } else { + /* EMULATE ld.d INSTRUCTION */ + v = do_load_word(dmax, dmtx & DMT_DAS); + if (reg != 0) + eframe[EF_R0 + reg] = v; + v = do_load_word(dmax ^ 4, + dmtx & DMT_DAS); + if (reg != 31) + eframe[EF_R0 + reg + 1] = v; + } + } else { + /* not pipeline #2 with a double */ + if (dmtx & DMT_WRITE) { + switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { + case DMT_BYTE: + DAE_DEBUG( + printf("[byte %x -> [%x(%c)]\n", + dmdx & 0xff, dmax, + ISSET(dmtx, DMT_DAS) ? 's' : 'u') + ); + do_store_byte(dmax, dmdx, + dmtx & DMT_DAS); + break; + case DMT_HALF: + DAE_DEBUG( + printf("[half %x -> [%x(%c)]\n", + dmdx & 0xffff, dmax, + ISSET(dmtx, DMT_DAS) ? 's' : 'u') + ); + do_store_half(dmax, dmdx, + dmtx & DMT_DAS); + break; + case DMT_WORD: + DAE_DEBUG( + printf("[word %x -> [%x(%c)]\n", + dmdx, dmax, + ISSET(dmtx, DMT_DAS) ? 's' : 'u') + ); + do_store_word(dmax, dmdx, + dmtx & DMT_DAS); + break; + } + } else { + /* else it's a read */ + switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { + case DMT_BYTE: + v = do_load_byte(dmax, + dmtx & DMT_DAS); + if (!ISSET(dmtx, DMT_SIGNED)) + v &= 0x000000ff; + break; + case DMT_HALF: + v = do_load_half(dmax, + dmtx & DMT_DAS); + if (!ISSET(dmtx, DMT_SIGNED)) + v &= 0x0000ffff; + break; + case DMT_WORD: + v = do_load_word(dmax, + dmtx & DMT_DAS); + break; + } + DAE_DEBUG( + if (reg == 0) + printf("[no write to r0 done]\n"); + else + printf("[r%d <- %x]\n", reg, v); + ); + if (reg != 0) + eframe[EF_R0 + reg] = v; + } + } + } else { + /* if lockbar is set... it's part of an XMEM */ + /* + * According to Motorola's "General Information", + * the DMT_DOUB1 bit is never set in this case, as it + * should be. + * If lockbar is set (as it is if we're here) and if + * the write is not set, then it's the same as if DOUB1 + * was set... + */ + if (!ISSET(dmtx, DMT_WRITE)) { + if (x != 2) { + /* RERUN xmem WITH DMD(x+1) */ + x++; + dmdx = eframe[EF_DMD0 + x * 3]; + } else { + /* RERUN xmem WITH DMD2 */ + } + + if (dmt_en_info[DMT_ENBITS(dmtx)].size == + DMT_WORD) { + v = do_xmem_word(dmax, dmdx, + dmtx & DMT_DAS); + } else { + v = do_xmem_byte(dmax, dmdx, + dmtx & DMT_DAS); + } + if (reg != 0) + eframe[EF_R0 + reg] = v; + } else { + if (x == 0) { + if (reg != 0) + eframe[EF_R0 + reg] = dmdx; + eframe[EF_SFIP] = eframe[EF_SNIP]; + eframe[EF_SNIP] = eframe[EF_SXIP]; + eframe[EF_SXIP] = 0; + /* xmem RERUN ON rte */ + eframe[EF_DMT0] = 0; + return; + } + } + } + } + eframe[EF_DMT0] = 0; +} diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S index 3fb0616e528..954d57c2316 100644 --- a/sys/arch/m88k/m88k/subr.S +++ b/sys/arch/m88k/m88k/subr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.S,v 1.2 2004/07/07 21:18:11 miod Exp $ */ +/* $OpenBSD: subr.S,v 1.3 2004/08/01 17:18:05 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -37,12 +37,14 @@ #include <machine/cpu_number.h> #include <machine/trap.h> -/***************************************************************************** +#ifdef M88100 + +/* * DO_LOAD_ADDRESS * * unsigned int do_load_word(address, supervisor_mode) - * vaddr_t address; \\ in r2 - * boolean_t supervisor_mode; \\ in r3 + * vaddr_t address; \\ in r2 + * boolean_t supervisor_mode; \\ in r3 * * Return the word at ADDRESS (from user space if SUPERVISOR_MODE is zero, * supervisor space if non-zero). @@ -169,6 +171,8 @@ ENTRY(do_xmem_byte) /* do_xmem_byte(address, data, supervisor) */ 1: xmem.bu r3,r2,r0 2: jmp r1 +#endif /* M88100 */ + /* * Copy specified amount of data from user space into the kernel * copyin(from, to, len) diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index 630f999246e..642e77a7c87 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.23 2004/07/28 12:28:48 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.24 2004/08/01 17:18:05 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -9,26 +9,7 @@ * C prototypes for various routines defined in locore_* and friends */ -/* locore_asm_routines.S */ - -unsigned int do_load_word(vaddr_t address, - boolean_t supervisor_mode); -unsigned int do_load_half(vaddr_t address, - boolean_t supervisor_mode); -unsigned int do_load_byte(vaddr_t address, - boolean_t supervisor_mode); - -void do_store_word(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -void do_store_half(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -void do_store_byte(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); - -unsigned do_xmem_word(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); -unsigned do_xmem_byte(vaddr_t address, unsigned int data, - boolean_t supervisor_mode); +/* subr.S */ unsigned read_processor_identification_register(void); int badaddr(vaddr_t addr, int size); @@ -41,9 +22,6 @@ int guarded_access(unsigned char *volatile address, /* locore_c_routines.c */ -void dae_print(unsigned *eframe); -void data_access_emulation(unsigned *eframe); - unsigned getipl(void); /* machdep.c */ diff --git a/sys/arch/mvme88k/mvme88k/locore_c_routines.c b/sys/arch/mvme88k/mvme88k/locore_c_routines.c index fbbd0d86500..91ff8c73d86 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.40 2004/07/22 18:58:04 miod Exp $ */ +/* $OpenBSD: locore_c_routines.c,v 1.41 2004/08/01 17:18:05 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -26,23 +26,16 @@ * rights to redistribute these changes. */ -#include "assym.h" - #include <sys/param.h> -#include <sys/types.h> #include <sys/systm.h> #include <machine/board.h> /* m188 bit defines */ -#include <machine/cmmu.h> /* DMT_VALID */ #include <machine/asm.h> /* END_OF_VECTOR_LIST, etc. */ #include <machine/asm_macro.h> /* enable/disable interrupts */ #include <machine/cpu_number.h> /* cpu_number() */ #include <machine/locore.h> #include <machine/prom.h> #include <machine/trap.h> -#ifdef M88100 -#include <machine/m88100.h> -#endif typedef struct { unsigned word_one, word_two; @@ -51,241 +44,9 @@ typedef struct { extern unsigned int *volatile int_mask_reg[MAX_CPUS]; /* in machdep.c */ extern unsigned master_cpu; /* in cmmu.c */ -/* FORWARDS */ void setlevel(unsigned int); void vector_init(m88k_exception_vector_area *, unsigned *); -#ifdef M88100 - -/* - * data access emulation for M88100 exceptions - */ - -#define DMT_BYTE 1 -#define DMT_HALF 2 -#define DMT_WORD 4 - -const struct { - unsigned char offset; - unsigned char size; -} dmt_en_info[16] = { - {0, 0}, {3, DMT_BYTE}, {2, DMT_BYTE}, {2, DMT_HALF}, - {1, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, - {0, DMT_BYTE}, {0, 0}, {0, 0}, {0, 0}, - {0, DMT_HALF}, {0, 0}, {0, 0}, {0, DMT_WORD} -}; - -#ifdef DATA_DEBUG -int data_access_emulation_debug = 0; -#define DAE_DEBUG(stuff) \ - do { \ - if (data_access_emulation_debug != 0) { \ - stuff; \ - } \ - } while (0) -#else -#define DAE_DEBUG(stuff) -#endif - -void -dae_print(unsigned *eframe) -{ - int x; - unsigned dmax, dmdx, dmtx; - - if (!ISSET(eframe[EF_DMT0], DMT_VALID)) - return; - - for (x = 0; x < 3; x++) { - dmtx = eframe[EF_DMT0 + x * 3]; - if (!ISSET(dmtx, DMT_VALID)) - continue; - - dmdx = eframe[EF_DMD0 + x * 3]; - dmax = eframe[EF_DMA0 + x * 3]; - - if (ISSET(dmtx, DMT_WRITE)) - printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, - DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - else - printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', - DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - } -} - -void -data_access_emulation(unsigned *eframe) -{ - int x; - unsigned dmax, dmdx, dmtx; - unsigned v, reg; - - dmtx = eframe[EF_DMT0]; - if (!ISSET(dmtx, DMT_VALID)) - return; - - for (x = 0; x < 3; x++) { - dmtx = eframe[EF_DMT0 + x * 3]; - if (!ISSET(dmtx, DMT_VALID) || ISSET(dmtx, DMT_SKIP)) - continue; - - dmdx = eframe[EF_DMD0 + x * 3]; - dmax = eframe[EF_DMA0 + x * 3]; - - DAE_DEBUG( - if (ISSET(dmtx, DMT_WRITE)) - printf("[DMT%d=%x: st.%c %x to %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', dmdx, dmax, - DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem"); - else - printf("[DMT%d=%x: ld.%c r%d <- %x as %d %s %s]\n", - x, dmtx, dmtx & DMT_DAS ? 's' : 'u', - DMT_DREGBITS(dmtx), dmax, DMT_ENBITS(dmtx), - dmtx & DMT_DOUB1 ? "double": "not double", - dmtx & DMT_LOCKBAR ? "xmem": "not xmem") - ); - - dmax += dmt_en_info[DMT_ENBITS(dmtx)].offset; - reg = DMT_DREGBITS(dmtx); - - if (!ISSET(dmtx, DMT_LOCKBAR)) { - /* the fault is not during an XMEM */ - - if (x == 2 && ISSET(dmtx, DMT_DOUB1)) { - /* pipeline 2 (earliest stage) for a double */ - - if (ISSET(dmtx, DMT_WRITE)) { - /* - * STORE DOUBLE WILL BE REINITIATED - * BY rte - */ - } else { - /* EMULATE ld.d INSTRUCTION */ - v = do_load_word(dmax, dmtx & DMT_DAS); - if (reg != 0) - eframe[EF_R0 + reg] = v; - v = do_load_word(dmax ^ 4, - dmtx & DMT_DAS); - if (reg != 31) - eframe[EF_R0 + reg + 1] = v; - } - } else { - /* not pipeline #2 with a double */ - if (dmtx & DMT_WRITE) { - switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { - case DMT_BYTE: - DAE_DEBUG( - printf("[byte %x -> [%x(%c)]\n", - dmdx & 0xff, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_byte(dmax, dmdx, - dmtx & DMT_DAS); - break; - case DMT_HALF: - DAE_DEBUG( - printf("[half %x -> [%x(%c)]\n", - dmdx & 0xffff, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_half(dmax, dmdx, - dmtx & DMT_DAS); - break; - case DMT_WORD: - DAE_DEBUG( - printf("[word %x -> [%x(%c)]\n", - dmdx, dmax, - ISSET(dmtx, DMT_DAS) ? 's' : 'u') - ); - do_store_word(dmax, dmdx, - dmtx & DMT_DAS); - break; - } - } else { - /* else it's a read */ - switch (dmt_en_info[DMT_ENBITS(dmtx)].size) { - case DMT_BYTE: - v = do_load_byte(dmax, - dmtx & DMT_DAS); - if (!ISSET(dmtx, DMT_SIGNED)) - v &= 0x000000ff; - break; - case DMT_HALF: - v = do_load_half(dmax, - dmtx & DMT_DAS); - if (!ISSET(dmtx, DMT_SIGNED)) - v &= 0x0000ffff; - break; - case DMT_WORD: - v = do_load_word(dmax, - dmtx & DMT_DAS); - break; - } - DAE_DEBUG( - if (reg == 0) - printf("[no write to r0 done]\n"); - else - printf("[r%d <- %x]\n", reg, v); - ); - if (reg != 0) - eframe[EF_R0 + reg] = v; - } - } - } else { - /* if lockbar is set... it's part of an XMEM */ - /* - * According to Motorola's "General Information", - * the DMT_DOUB1 bit is never set in this case, as it - * should be. - * If lockbar is set (as it is if we're here) and if - * the write is not set, then it's the same as if DOUB1 - * was set... - */ - if (!ISSET(dmtx, DMT_WRITE)) { - if (x != 2) { - /* RERUN xmem WITH DMD(x+1) */ - x++; - dmdx = eframe[EF_DMD0 + x * 3]; - } else { - /* RERUN xmem WITH DMD2 */ - } - - if (dmt_en_info[DMT_ENBITS(dmtx)].size == - DMT_WORD) { - v = do_xmem_word(dmax, dmdx, - dmtx & DMT_DAS); - } else { - v = do_xmem_byte(dmax, dmdx, - dmtx & DMT_DAS); - } - if (reg != 0) - eframe[EF_R0 + reg] = v; - } else { - if (x == 0) { - if (reg != 0) - eframe[EF_R0 + reg] = dmdx; - eframe[EF_SFIP] = eframe[EF_SNIP]; - eframe[EF_SNIP] = eframe[EF_SXIP]; - eframe[EF_SXIP] = 0; - /* xmem RERUN ON rte */ - eframe[EF_DMT0] = 0; - return; - } - } - } - } - eframe[EF_DMT0] = 0; -} -#endif /* M88100 */ - #define SIGSYS_MAX 501 #define SIGTRAP_MAX 510 |