git: 3ab140921420 - stable/13 - arm64: Use a switch to decide when to enable debug

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Mon, 15 Jul 2024 12:38:10 UTC
The branch stable/13 has been updated by andrew:

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

commit 3ab140921420046c3112769d7f00563f4d9b7f97
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2024-03-12 16:47:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2024-07-15 12:34:28 +0000

    arm64: Use a switch to decide when to enable debug
    
    Use a switch statement to decide which exceptions we need to call
    dbg_enable for. This simplifies adding more esceptions to the list in
    the future.
    
    Reviewed by:    jhb
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D44352
    
    (cherry picked from commit d93b3a65f7697630ca1dd2635fc976f3ef36b602)
---
 sys/arm64/arm64/trap.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 74122cd508ab..4a659e9d5538 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -467,9 +467,15 @@ do_el1h_sync(struct thread *td, struct trapframe *frame)
 	 * Enable debug exceptions if we aren't already handling one. They will
 	 * be masked again in the exception handler's epilogue.
 	 */
-	if (exception != EXCP_BRK && exception != EXCP_WATCHPT_EL1 &&
-	    exception != EXCP_SOFTSTP_EL1)
+	switch (exception) {
+	case EXCP_BRK:
+	case EXCP_WATCHPT_EL1:
+	case EXCP_SOFTSTP_EL1:
+		break;
+	default:
 		dbg_enable();
+		break;
+	}
 
 	switch (exception) {
 	case EXCP_FP_SIMD: