diff options
-rw-r--r-- | regress/sys/arch/m88k/usertrap/answer | 20 | ||||
-rw-r--r-- | regress/sys/arch/m88k/usertrap/testsuite.sh | 4 | ||||
-rw-r--r-- | sys/arch/luna88k/include/locore.h | 3 | ||||
-rw-r--r-- | sys/arch/luna88k/luna88k/machdep.c | 3 | ||||
-rw-r--r-- | sys/arch/m88k/include/cmmu.h | 6 | ||||
-rw-r--r-- | sys/arch/m88k/include/trap.h | 10 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 40 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m8820x_machdep.c | 16 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 26 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vs.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/locore.h | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/m88110.c | 8 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 4 |
13 files changed, 100 insertions, 48 deletions
diff --git a/regress/sys/arch/m88k/usertrap/answer b/regress/sys/arch/m88k/usertrap/answer index 95474cdae6e..3285d6116b9 100644 --- a/regress/sys/arch/m88k/usertrap/answer +++ b/regress/sys/arch/m88k/usertrap/answer @@ -449,7 +449,7 @@ Bad system call Bad system call Bad system call Bad system call -Bad system call + Bad system call Bad system call Bad system call @@ -500,13 +500,13 @@ Bad system call Bad system call Bad system call Bad system call -Trace trap +Trace/BPT trap Floating point exception -Trace trap -Trace trap -Trace trap -Trace trap -Trace trap -Trace trap -Trace trap -Trace trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap +Trace/BPT trap diff --git a/regress/sys/arch/m88k/usertrap/testsuite.sh b/regress/sys/arch/m88k/usertrap/testsuite.sh index 09f5b0b2176..730b8eae423 100644 --- a/regress/sys/arch/m88k/usertrap/testsuite.sh +++ b/regress/sys/arch/m88k/usertrap/testsuite.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $OpenBSD: testsuite.sh,v 1.1 2004/04/24 13:19:15 miod Exp $ +# $OpenBSD: testsuite.sh,v 1.2 2005/04/27 14:09:43 miod Exp $ # Simple test program to check what happens when userland tries to trap. # Written by Miodrag Vallat 2003 AD -- public domain @@ -460,6 +460,8 @@ ${PROG} 448 ${PROG} 449 ${PROG} 450 ${PROG} 451 +# since there won't be any output... +echo ${PROG} 452 ${PROG} 453 ${PROG} 454 diff --git a/sys/arch/luna88k/include/locore.h b/sys/arch/luna88k/include/locore.h index 9ec874e4961..f31fd89595b 100644 --- a/sys/arch/luna88k/include/locore.h +++ b/sys/arch/luna88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.4 2004/10/03 19:47:25 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.5 2005/04/27 14:09:45 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -26,5 +26,6 @@ void sigtrap(void); void stepbpt(void); void userbpt(void); void syscall_handler(void); +void cache_flush_handler(void); #endif /* _MACHINE_LOCORE_H_ */ diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c index cc881c98e91..3eb477b1455 100644 --- a/sys/arch/luna88k/luna88k/machdep.c +++ b/sys/arch/luna88k/luna88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.17 2004/11/09 15:02:19 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.18 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1445,6 +1445,7 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) SET_VECTOR(num, sigtrap); SET_VECTOR(450, syscall_handler); + SET_VECTOR(451, cache_flush_handler); SET_VECTOR(504, stepbpt); SET_VECTOR(511, userbpt); diff --git a/sys/arch/m88k/include/cmmu.h b/sys/arch/m88k/include/cmmu.h index 38356352266..18c5cbda4d8 100644 --- a/sys/arch/m88k/include/cmmu.h +++ b/sys/arch/m88k/include/cmmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.h,v 1.7 2005/04/27 14:07:09 miod Exp $ */ +/* $OpenBSD: cmmu.h,v 1.8 2005/04/27 14:09:45 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -61,7 +61,7 @@ struct cmmu_p { void (*cmmu_flush_cache_func)(int, paddr_t, psize_t); void (*cmmu_flush_inst_cache_func)(int, paddr_t, psize_t); void (*cmmu_flush_data_cache_func)(int, paddr_t, psize_t); - void (*dma_cachectl_func)(vaddr_t, vsize_t, int); + void (*dma_cachectl_func)(pmap_t, vaddr_t, vsize_t, int); void (*dma_cachectl_pa_func)(paddr_t, psize_t, int); /* DDB only */ void (*cmmu_dump_config_func)(void); @@ -86,7 +86,7 @@ extern struct cmmu_p *cmmu; #define cmmu_flush_cache(a, b, c) (cmmu->cmmu_flush_cache_func)(a, b, c) #define cmmu_flush_inst_cache(a, b, c) (cmmu->cmmu_flush_inst_cache_func)(a, b, c) #define cmmu_flush_data_cache(a, b, c) (cmmu->cmmu_flush_data_cache_func)(a, b, c) -#define dma_cachectl(a, b, c) (cmmu->dma_cachectl_func)(a, b, c) +#define dma_cachectl(a, b, c, d) (cmmu->dma_cachectl_func)(a, b, c, d) #define dma_cachectl_pa(a, b, c) (cmmu->dma_cachectl_pa_func)(a, b, c) #define cmmu_dump_config (cmmu->cmmu_dump_config_func) #define cmmu_show_translation(a, b, c, d) (cmmu->cmmu_show_translation_func)(a, b, c, d) diff --git a/sys/arch/m88k/include/trap.h b/sys/arch/m88k/include/trap.h index 940fb3cc21a..bd7984e6fd9 100644 --- a/sys/arch/m88k/include/trap.h +++ b/sys/arch/m88k/include/trap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.h,v 1.1 2004/04/26 12:34:05 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.2 2005/04/27 14:09:45 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -66,13 +66,11 @@ #define T_USER 29 /* user mode fault */ #ifndef _LOCORE - -void m88100_trap(unsigned, struct trapframe *); +void cache_flush(struct trapframe *); void m88100_syscall(register_t, struct trapframe *); - -void m88110_trap(unsigned, struct trapframe *); +void m88100_trap(unsigned, struct trapframe *); void m88110_syscall(register_t, struct trapframe *); - +void m88110_trap(unsigned, struct trapframe *); #endif /* _LOCORE */ #endif /* __MACHINE_TRAP_H__ */ diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index e51bcf73a85..961b9e52bd4 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.7 2005/04/19 18:37:52 mickey Exp $ */ +/* $OpenBSD: eh_common.S,v 1.8 2005/04/27 14:09:45 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -68,8 +68,8 @@ * is complete. * * Traps are also exceptions. Traps are ways for user programs to request - * kernel operations. For example, "tcnd eq0, r0, 128" will raise - * exception 128, the system call exception. + * kernel operations. For example, "tcnd eq0, r0, 450" will raise + * exception 450, the system call exception. * * * SERVICING AN EXCEPTION @@ -509,14 +509,23 @@ GLOBAL(fp_imprecise_handler) CALL(_ASM_LABEL(Xfp_imprecise), r0, r30) DONE88100 -/* All standard system calls. */ +/* trap 450: system calls */ GLOBAL(syscall_handler) - PREP88100("syscall", 128,,) + PREP88100("syscall", 450,,) ld r13, r30, GENREG_OFF(13) CALL(_C_LABEL(m88100_syscall), r13, r30) DONE88100 -/* trap 496 comes here */ +/* trap 451: cache flush (necessary for trampolines) */ +GLOBAL(cache_flush_handler) + PREP88100("cache_flush", 451,,) + sub r31, r31, 32 + bsr.n _C_LABEL(cache_flush) + or r2, r0, r30 + add r31, r31, 32 + DONE88100 + +/* trap 496: BUG system calls */ GLOBAL(bugtrap) PREP88100("bugsyscall", 496,,) ld r9, r30, GENREG_OFF(9) @@ -1614,7 +1623,7 @@ ENTRY(proc_do_uret) #endif /* - * Regs r1-r30 are free. R31 is pointing at the word + * Regs r1-r30 are free. r31 is pointing at the word * on the kernel stack where our pointer to the exception frame * it stored. Reload it now. * @@ -1919,14 +1928,23 @@ GLOBAL(m88110_inst_atc_miss) CALL(_C_LABEL(m88110_trap), T_197_INST, r30) DONE88110 -/* All standard system calls. */ +/* trap 450: system calls */ GLOBAL(m88110_syscall_handler) - PREP88110("syscall", 128,) + PREP88110("syscall", 450,) ld r13, r30, GENREG_OFF(13) CALL(_C_LABEL(m88110_syscall), r13, r30) DONE88110 -/* trap 496 comes here */ +/* trap 451: cache flush (necessary for trampolines) */ +GLOBAL(m88110_cache_flush_handler) + PREP88110("cache_flush", 451,) + sub r31, r31, 32 + bsr.n _C_LABEL(cache_flush) + or r2, r0, r30 + add r31, r31, 32 + DONE88110 + +/* trap 496: BUG system calls */ GLOBAL(m88110_bugtrap) PREP88110("bugsyscall", 496,) ld r9, r30, GENREG_OFF(9) @@ -2079,7 +2097,7 @@ GLOBAL(m88110_reset_handler) st r10, r31, REG_OFF(EF_MODE) 1: - /* retrieve saved shadow registers for error_handler, though) */ + /* retrieve saved shadow registers for error_handler */ or.u r30, r0, hi16(_ASM_LABEL(save_frame)) or r30, r30, lo16(_ASM_LABEL(save_frame)) ld r10, r30, REG_OFF(EF_EPSR) diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c index a1f7047f951..5239e0b3263 100644 --- a/sys/arch/m88k/m88k/m8820x_machdep.c +++ b/sys/arch/m88k/m88k/m8820x_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m8820x_machdep.c,v 1.4 2005/04/27 14:07:38 miod Exp $ */ +/* $OpenBSD: m8820x_machdep.c,v 1.5 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * @@ -115,7 +115,7 @@ void m8820x_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, vsize_t); void m8820x_cmmu_flush_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m8820x_cmmu_flush_data_cache(int, paddr_t, psize_t); -void m8820x_dma_cachectl(vaddr_t, vsize_t, int); +void m8820x_dma_cachectl(pmap_t, vaddr_t, vsize_t, int); void m8820x_dma_cachectl_pa(paddr_t, psize_t, int); void m8820x_cmmu_dump_config(void); void m8820x_cmmu_show_translation(unsigned, unsigned, unsigned, int); @@ -811,7 +811,7 @@ m8820x_cmmu_inval_cache(paddr_t physaddr, psize_t size) } void -m8820x_dma_cachectl(vaddr_t va, vsize_t size, int op) +m8820x_dma_cachectl(pmap_t pmap, vaddr_t va, vsize_t size, int op) { paddr_t pa; #if !defined(BROKEN_MMU_MASK) @@ -825,7 +825,7 @@ m8820x_dma_cachectl(vaddr_t va, vsize_t size, int op) while (size != 0) { count = min(size, PAGE_SIZE); - if (pmap_extract(pmap_kernel(), va, &pa) != FALSE) { + if (pmap_extract(pmap, va, &pa) != FALSE) { switch (op) { case DMA_CACHE_SYNC: m8820x_cmmu_sync_cache(pa, count); @@ -843,8 +843,12 @@ m8820x_dma_cachectl(vaddr_t va, vsize_t size, int op) size -= count; } #else - /* XXX This assumes the space is also physically contiguous */ - if (pmap_extract(pmap_kernel(), va, &pa) != FALSE) { + /* + * This assumes the space is also physically contiguous... but this + * really doesn't matter as we flush/sync/invalidate the whole cache + * anyway... + */ + if (pmap_extract(pmap, va, &pa) != FALSE) { switch (op) { case DMA_CACHE_SYNC: m8820x_cmmu_sync_cache(pa, size); diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index bd627908897..e2a37016ade 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.15 2004/12/06 20:12:24 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.16 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -60,6 +60,7 @@ #include <uvm/uvm_extern.h> #include <machine/asm_macro.h> /* enable/disable interrupts */ +#include <machine/cmmu.h> #include <machine/cpu.h> #include <machine/locore.h> #ifdef M88100 @@ -1813,3 +1814,26 @@ double_reg_fixup(struct trapframe *frame) return 0; } + +void +cache_flush(struct trapframe *tf) +{ + struct proc *p; + struct pmap *pmap; + u_quad_t sticks; + + if ((p = curproc) == NULL) + p = &proc0; + p = curproc; + + sticks = p->p_sticks; + p->p_md.md_tf = tf; + + pmap = vm_map_pmap(&p->p_vmspace->vm_map); + dma_cachectl(pmap, tf->tf_r[2], tf->tf_r[3], DMA_CACHE_SYNC); + + tf->tf_snip = tf->tf_snip & ~NIP_E; + tf->tf_sfip = tf->tf_sfip & ~FIP_E; + + userret(p, tf, sticks); +} diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index dc9576218a4..3c570d1384f 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.54 2005/04/27 14:07:38 miod Exp $ */ +/* $OpenBSD: vs.c,v 1.55 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. @@ -408,7 +408,7 @@ vs_scsicmd(struct scsi_xfer *xs) * to flush the cache for a write and flush with inval for * a read, prior to starting the IO. */ - dma_cachectl((vaddr_t)xs->data, xs->datalen, + dma_cachectl(pmap_kernel(), (vaddr_t)xs->data, xs->datalen, flags & SCSI_DATA_IN ? DMA_CACHE_SYNC_INVAL : DMA_CACHE_SYNC); option = 0; diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index e57fc9ef3b8..ee7a7ca8161 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.26 2004/11/09 21:50:01 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.27 2005/04/27 14:09:45 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -33,10 +33,12 @@ 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); +void m88110_cache_flush_handler(void); #endif /* _MACHINE_LOCORE_H_ */ diff --git a/sys/arch/mvme88k/mvme88k/m88110.c b/sys/arch/mvme88k/mvme88k/m88110.c index c35872fad79..9a5a185a5a9 100644 --- a/sys/arch/mvme88k/mvme88k/m88110.c +++ b/sys/arch/mvme88k/mvme88k/m88110.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88110.c,v 1.19 2005/04/27 14:07:38 miod Exp $ */ +/* $OpenBSD: m88110.c,v 1.20 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * All rights reserved. @@ -100,7 +100,7 @@ void m88110_cmmu_flush_tlb(unsigned, unsigned, vaddr_t, vsize_t); void m88110_cmmu_flush_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_inst_cache(int, paddr_t, psize_t); void m88110_cmmu_flush_data_cache(int, paddr_t, psize_t); -void m88110_dma_cachectl(vaddr_t, vsize_t, int); +void m88110_dma_cachectl(pmap_t, vaddr_t, vsize_t, int); void m88110_dma_cachectl_pa(paddr_t, psize_t, int); void m88110_cmmu_dump_config(void); void m88110_cmmu_show_translation(unsigned, unsigned, unsigned, int); @@ -483,11 +483,11 @@ m88110_cmmu_inval_cache(paddr_t physaddr, psize_t size) } void -m88110_dma_cachectl(vaddr_t va, vsize_t size, int op) +m88110_dma_cachectl(pmap_t pmap, vaddr_t va, vsize_t size, int op) { paddr_t pa; - if (pmap_extract(pmap_kernel(), va, &pa) == FALSE) + if (pmap_extract(pmap, va, &pa) == FALSE) return; /* XXX */ switch (op) { diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 6817f11f0c1..0486e54b5d3 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.163 2004/12/02 19:40:46 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.164 2005/04/27 14:09:45 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -1286,6 +1286,7 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) SET_VECTOR(num, m88110_sigtrap); SET_VECTOR(450, m88110_syscall_handler); + SET_VECTOR(451, m88110_cache_flush_handler); SET_VECTOR(MVMEPROM_VECTOR, m88110_bugtrap); SET_VECTOR(504, m88110_stepbpt); SET_VECTOR(511, m88110_userbpt); @@ -1300,6 +1301,7 @@ vector_init(m88k_exception_vector_area *vector, unsigned *vector_init_list) SET_VECTOR(num, sigtrap); SET_VECTOR(450, syscall_handler); + SET_VECTOR(451, cache_flush_handler); SET_VECTOR(MVMEPROM_VECTOR, bugtrap); SET_VECTOR(504, stepbpt); SET_VECTOR(511, userbpt); |