diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-21 19:30:10 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-11-21 19:30:10 +0000 |
commit | 7b31103729484aad21bbf84ed14168ff47e1602e (patch) | |
tree | 06bca2e4c107bdb7686c2438df85d1ae5f2bac93 | |
parent | 2c948961917f33a1297348f41a40465b09785462 (diff) |
Move external interrupt and ast handling from m881[01]0_trap() to their
own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
-rw-r--r-- | sys/arch/m88k/include/trap.h | 72 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/eh_common.S | 33 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 78 |
3 files changed, 84 insertions, 99 deletions
diff --git a/sys/arch/m88k/include/trap.h b/sys/arch/m88k/include/trap.h index e617c73d958..185f66e40ef 100644 --- a/sys/arch/m88k/include/trap.h +++ b/sys/arch/m88k/include/trap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.h,v 1.4 2007/11/17 05:36:23 miod Exp $ */ +/* $OpenBSD: trap.h,v 1.5 2007/11/21 19:30:08 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -27,43 +27,51 @@ /* * Trap codes */ -#ifndef __MACHINE_TRAP_H__ -#define __MACHINE_TRAP_H__ +#ifndef __M88K_TRAP_H__ +#define __M88K_TRAP_H__ /* * Trap type values */ +#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_KDB_ENTRY 9 /* force entry to kernel debugger */ +#define T_KDB_BREAK 10 /* break point hit */ +#define T_KDB_TRACE 11 /* trace */ +#define T_UNKNOWNFLT 12 /* unknown exception */ +#define T_SIGSYS 13 /* generate SIGSYS */ +#define T_STEPBPT 14 /* special breakpoint for single step */ +#define T_USERBPT 15 /* user set breakpoint (for debugger) */ +#define T_110_DRM 16 /* 88110 data read miss (sw table walk) */ +#define T_110_DWM 17 /* 88110 data write miss (sw table walk) */ +#define T_110_IAM 18 /* 88110 inst ATC miss (sw table walk) */ -#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 */ +#define T_USER 19 /* user mode fault */ + +/* + * Interrupt type values + */ +#define T_INT 0 /* regular interrupts */ +#define T_NON_MASK 1 /* non-maskable interrupts */ #ifndef _LOCORE -void cache_flush(struct trapframe *); -void m88100_syscall(register_t, struct trapframe *); -void m88100_trap(u_int, struct trapframe *); -void m88110_syscall(register_t, struct trapframe *); -void m88110_trap(u_int, struct trapframe *); + +void cache_flush(struct trapframe *); +void ast(struct trapframe *); +void interrupt(u_int, struct trapframe *); + +void m88100_syscall(register_t, struct trapframe *); +void m88100_trap(u_int, struct trapframe *); +void m88110_syscall(register_t, struct trapframe *); +void m88110_trap(u_int, struct trapframe *); + #endif /* _LOCORE */ -#endif /* __MACHINE_TRAP_H__ */ +#endif /* __M88K_TRAP_H__ */ diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S index aedd5f18ad9..478faccecb9 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.33 2007/11/17 05:36:23 miod Exp $ */ +/* $OpenBSD: eh_common.S,v 1.34 2007/11/21 19:30:09 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1991 Carnegie Mellon University @@ -432,7 +432,7 @@ GLOBAL(interrupt_handler) PREP88100("interrupt", 1,,) or r2, r0, T_INT or r3, r0, r30 - XCALL(_C_LABEL(m88100_trap), _ASM_LABEL(check_ast)) + XCALL(_C_LABEL(interrupt), _ASM_LABEL(check_ast)) /* instruction access exception handler */ GLOBAL(instruction_access_handler) @@ -1589,7 +1589,7 @@ GLOBAL(m88110_interrupt_handler) PREP88110("interrupt", 1,) or r2, r0, T_INT or r3, r0, r30 - XCALL(_C_LABEL(m88110_trap), _ASM_LABEL(check_ast)) + XCALL(_C_LABEL(interrupt), _ASM_LABEL(check_ast)) /* instruction access exception handler */ GLOBAL(m88110_instruction_access_handler) @@ -1660,7 +1660,7 @@ GLOBAL(m88110_nonmaskable) PREP88110("NMI", 11,) or r2, r0, T_NON_MASK or r3, r0, r30 - XCALL(_C_LABEL(m88110_trap), _ASM_LABEL(check_ast)) + XCALL(_C_LABEL(interrupt), _ASM_LABEL(check_ast)) /* software walk data MMU read miss handler */ GLOBAL(m88110_data_read_miss) @@ -2365,27 +2365,10 @@ ASGLOBAL(softint_done) ldcr r2, CPU ld r3, r2, CI_CURPROC ld r2, r3, P_ASTPENDING - bcnd.n eq0, r2, _ASM_LABEL(ast_done) - /* - * trap(T_ASTFLT,...) will service ast's. - */ - or r3, r0, FPTR - or r2, r0, T_ASTFLT -#if defined(M88110) && defined(M88100) - or.u r4, r0, hi16(_C_LABEL(cputyp)) - ld r5, r4, lo16(_C_LABEL(cputyp)) - cmp r4, r5, CPU_88110 - bb0 eq, r4, 2f -#endif -#if defined(M88110) - XCALL(_C_LABEL(m88110_trap), _ASM_LABEL(ast_done)) -#endif -#if defined(M88110) && defined(M88100) -2: -#endif -#ifdef M88100 - XCALL(_C_LABEL(m88100_trap), _ASM_LABEL(ast_done)) -#endif + bcnd eq0, r2, _ASM_LABEL(ast_done) + + or r2, r0, FPTR + XCALL(_C_LABEL(ast), _ASM_LABEL(ast_done)) /* * void proc_trampoline(void (*func)(void *), void *proc) diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index b5aa3014889..d6ef65126c1 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.46 2007/11/20 22:08:40 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.47 2007/11/21 19:30:09 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -173,6 +173,41 @@ panictrap(int type, struct trapframe *frame) /*NOTREACHED*/ } +/* + * Handle external interrupts. + */ +void +interrupt(u_int type, struct trapframe *frame) +{ + struct cpu_info *ci = curcpu(); + + ci->ci_intrdepth++; + md_interrupt_func(type, frame); + ci->ci_intrdepth--; +} + +/* + * Handle asynchronous software traps. + */ +void +ast(struct trapframe *frame) +{ + struct cpu_info *ci = curcpu(); + struct proc *p = ci->ci_curproc; + + uvmexp.softs++; + p->p_md.md_astpending = 0; + if (p->p_flag & P_OWEUPC) { + KERNEL_PROC_LOCK(p); + ADDUPROF(p); + KERNEL_PROC_UNLOCK(p); + } + if (ci->ci_want_resched) + preempt(NULL); + + userret(p); +} + #ifdef M88100 void m88100_trap(u_int type, struct trapframe *frame) @@ -231,12 +266,6 @@ m88100_trap(u_int type, struct trapframe *frame) printf("Unimplemented opcode!\n"); panictrap(frame->tf_vector, frame); break; - case T_INT: - case T_INT+T_USER: - curcpu()->ci_intrdepth++; - md_interrupt_func(T_INT, frame); - curcpu()->ci_intrdepth--; - return; case T_MISALGNFLT: printf("kernel misaligned access exception @ 0x%08x\n", @@ -535,17 +564,6 @@ user_fault: fault_type = TRAP_BRKPT; break; - case T_ASTFLT+T_USER: - uvmexp.softs++; - p->p_md.md_astpending = 0; - if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); - ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); - } - if (curcpu()->ci_want_resched) - preempt(NULL); - break; } /* @@ -678,18 +696,6 @@ m88110_trap(u_int type, struct trapframe *frame) printf("Unimplemented opcode!\n"); panictrap(frame->tf_vector, frame); break; - case T_NON_MASK: - case T_NON_MASK+T_USER: - curcpu()->ci_intrdepth++; - md_interrupt_func(T_NON_MASK, frame); - curcpu()->ci_intrdepth--; - return; - case T_INT: - case T_INT+T_USER: - curcpu()->ci_intrdepth++; - md_interrupt_func(T_INT, frame); - curcpu()->ci_intrdepth--; - return; case T_MISALGNFLT: printf("kernel mode misaligned access exception @ 0x%08x\n", frame->tf_exip); @@ -1029,18 +1035,6 @@ m88110_user_fault: sig = SIGTRAP; fault_type = TRAP_BRKPT; break; - - case T_ASTFLT+T_USER: - uvmexp.softs++; - p->p_md.md_astpending = 0; - if (p->p_flag & P_OWEUPC) { - KERNEL_PROC_LOCK(p); - ADDUPROF(p); - KERNEL_PROC_UNLOCK(p); - } - if (curcpu()->ci_want_resched) - preempt(NULL); - break; } /* |