A similar fix for the "sh" cpu, which is in the landisk.
Index: sh/sh/trap.c
===================================================================
RCS file: /cvs/src/sys/arch/sh/sh/trap.c,v
retrieving revision 1.40
diff -u -p -u -r1.40 trap.c
--- sh/sh/trap.c 6 Sep 2019 12:22:01 -0000 1.40
+++ sh/sh/trap.c 14 Sep 2020 11:44:56 -0000
@@ -155,7 +155,7 @@ void
general_exception(struct proc *p, struct trapframe *tf, uint32_t va)
{
int expevt = tf->tf_expevt;
- int tra;
+ int tra = _reg_read_4(SH_(TRA));
int usermode = !KERNELMODE(tf->tf_ssr);
union sigval sv;
@@ -191,7 +193,6 @@ general_exception(struct proc *p, struct
case EXPEVT_TRAPA:
#ifdef DDB
/* Check for ddb request */
- tra = _reg_read_4(SH_(TRA));
if (tra == (_SH_TRA_BREAK << 2) &&
db_ktrap(expevt, tra, tf))
return;
@@ -201,7 +202,6 @@ general_exception(struct proc *p, struct
break;
case EXPEVT_TRAPA | EXP_USER:
/* Check for debugger break */
- tra = _reg_read_4(SH_(TRA));
switch (tra) {
case _SH_TRA_BREAK << 2:
tf->tf_spc -= 2; /* back to the breakpoint address */