git: d055e974c4ee - stable/13 - arm64: Handle 32bits breakpoint exception.

From: Olivier Houchard <cognet_at_FreeBSD.org>
Date: Tue, 10 May 2022 09:15:32 UTC
The branch stable/13 has been updated by cognet:

URL: https://cgit.FreeBSD.org/src/commit/?id=d055e974c4eeb7237cd18c3fe84a87fbd09ae43b

commit d055e974c4eeb7237cd18c3fe84a87fbd09ae43b
Author:     Olivier Houchard <cognet@FreeBSD.org>
AuthorDate: 2021-09-21 13:49:45 +0000
Commit:     Olivier Houchard <cognet@FreeBSD.org>
CommitDate: 2022-05-10 09:14:40 +0000

    arm64: Handle 32bits breakpoint exception.
    
    A different exception is raised when we hit a 32bits breakpoint, rather than
    a 64bits one, so handle those as well when COMPAT_FREEBSD32 is defined.
    This should fix SIGBUS at least when using breakpoints with thumb2 code.
    
    PR:             256468
    MFC After:      1 week
    
    (cherry picked from commit 2734050154927eaa63d3b65de5d46d05569b3a5b)
---
 sys/arm64/arm64/trap.c     | 3 +++
 sys/arm64/include/armreg.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 75ae9e8fedac..5638bb9f496e 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -593,6 +593,9 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
 		break;
 	case EXCP_BRKPT_EL0:
 	case EXCP_BRK:
+#ifdef COMPAT_FREEBSD32
+	case EXCP_BRKPT_32:
+#endif /* COMPAT_FREEBSD32 */
 		call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr,
 		    exception);
 		userret(td, frame);
diff --git a/sys/arm64/include/armreg.h b/sys/arm64/include/armreg.h
index 1b46d0833429..8dc517f11a20 100644
--- a/sys/arm64/include/armreg.h
+++ b/sys/arm64/include/armreg.h
@@ -276,6 +276,7 @@
 #define	 EXCP_SOFTSTP_EL1	0x33	/* Software Step, from same EL */
 #define	 EXCP_WATCHPT_EL0	0x34	/* Watchpoint, from lower EL */
 #define	 EXCP_WATCHPT_EL1	0x35	/* Watchpoint, from same EL */
+#define	 EXCP_BRKPT_32		0x38    /* 32bits breakpoint */
 #define	 EXCP_BRK		0x3c	/* Breakpoint */
 
 /* ICC_CTLR_EL1 */