diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-05-13 17:19:57 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-05-13 17:19:57 +0000 |
commit | 75b3cba18a14f70fa4680bad1183f4ac8c0a6906 (patch) | |
tree | eda88d18082f8849aef839e19616b51d639544c0 /sys | |
parent | acaf195b6cbe4e0ff30b7aa4c682187a169cd4e9 (diff) |
Fix the problem that single-step tracing of a trap instruction
drops the system into kernel debugger; itohy@netbsd.org
Other m68k ports require similar changes
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hp300/hp300/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/locore.s | 14 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/trap.c | 9 |
3 files changed, 18 insertions, 8 deletions
diff --git a/sys/arch/hp300/hp300/genassym.cf b/sys/arch/hp300/hp300/genassym.cf index 47b5f4e95eb..a8528516459 100644 --- a/sys/arch/hp300/hp300/genassym.cf +++ b/sys/arch/hp300/hp300/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.7 2001/05/10 01:33:35 millert Exp $ +# $OpenBSD: genassym.cf,v 1.8 2001/05/13 17:19:56 millert Exp $ # $NetBSD: genassym.cf,v 1.11 1998/02/16 20:58:29 thorpej Exp $ # @@ -169,6 +169,7 @@ define PSL_IPL7 PSL_IPL7 define PSL_LOWIPL PSL_LOWIPL define PSL_HIGHIPL PSL_HIGHIPL define PSL_USER PSL_USER +define PSL_TS PSL_T | PSL_S define SPL1 PSL_S | PSL_IPL1 define SPL2 PSL_S | PSL_IPL2 define SPL3 PSL_S | PSL_IPL3 diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index db3044f0e8a..8f544d3e92e 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.25 2001/05/13 16:55:35 millert Exp $ */ +/* $OpenBSD: locore.s,v 1.26 2001/05/13 17:19:56 millert Exp $ */ /* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */ /* @@ -906,9 +906,17 @@ ENTRY_NOPROFILE(trace) clrl sp@- | stack adjust count moveml #0xFFFF,sp@- moveq #T_TRACE,d0 + + | Check PSW and see what happened. + | T=0 S=0 (should not happen) + | T=1 S=0 trace trap from user mode + | T=0 S=1 trace trap on a trap instruction + | T=1 S=1 trace trap from system mode (kernel breakpoint) + movw sp@(FR_HW),d1 | get PSW - andw #PSL_S,d1 | from system mode? - jne Lkbrkpt | yes, kernel breakpoint + notw d1 | XXX no support for T0 on 680[234]0 + andw #PSL_TS,d1 | from system mode (T=1, S=1)? + jeq Lkbrkpt | yes, kernel breakpoint jra _ASM_LABEL(fault) | no, user-mode fault /* diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index f7614c30d04..5b84697759b 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.21 2001/05/11 23:24:57 millert Exp $ */ +/* $OpenBSD: trap.c,v 1.22 2001/05/13 17:19:56 millert Exp $ */ /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */ /* @@ -536,10 +536,9 @@ trap(type, code, v, frame) * SUN 3.x traps get passed through as T_TRAP15 and are not really * supported yet. * - * XXX: We should never get kernel-mode T_TRACE or T_TRAP15 + * XXX: We should never get kernel-mode T_TRAP15 * XXX: because locore.s now gives them special treatment. */ - case T_TRACE: /* kernel trace trap */ case T_TRAP15: /* kernel breakpoint */ #ifdef DEBUG printf("unexpected kernel trace trap, type = %d\n", type); @@ -549,7 +548,6 @@ trap(type, code, v, frame) return; case T_TRACE|T_USER: /* user trace trap */ - case T_TRAP15|T_USER: /* SUN user trace trap */ #ifdef COMPAT_SUNOS /* * SunOS uses Trap #2 for a "CPU cache flush". @@ -561,6 +559,9 @@ trap(type, code, v, frame) return; } #endif + /* FALLTHROUGH */ + case T_TRACE: /* tracing a trap instruction */ + case T_TRAP15|T_USER: /* SUN user trace trap */ frame.f_sr &= ~PSL_T; i = SIGTRAP; typ = TRAP_TRACE; |