Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2026 01:52:21 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 0d98b06ab1ce - stable/15 - amd64: move code to clear PSL_T on debug exception into a helper
Message-ID:  <69c5e2d5.1f887.65695a35@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by kib:

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

commit 0d98b06ab1ce08d5b0b2d403a97d83410f2da425
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-03-12 09:40:44 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-03-26 23:42:56 +0000

    amd64: move code to clear PSL_T on debug exception into a helper
    
    (cherry picked from commit d92ebde76430e99f78156fb1d865a18916380aed)
---
 sys/amd64/amd64/trap.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 6393da186db5..3a9323936d2d 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -249,6 +249,17 @@ trap_check_pcb_onfault(struct thread *td, struct trapframe *frame)
 	return (res);
 }
 
+static void
+trap_clear_step(struct thread *td, struct trapframe *frame)
+{
+	PROC_LOCK(td->td_proc);
+	if ((td->td_dbgflags & TDB_STEP) != 0) {
+		td->td_frame->tf_rflags &= ~PSL_T;
+		td->td_dbgflags &= ~TDB_STEP;
+	}
+	PROC_UNLOCK(td->td_proc);
+}
+
 /*
  * Table of handlers for various segment load faults.
  */
@@ -395,14 +406,8 @@ trap(struct trapframe *frame)
 			signo = SIGTRAP;
 			ucode = TRAP_TRACE;
 			dr6 = rdr6();
-			if ((dr6 & DBREG_DR6_BS) != 0) {
-				PROC_LOCK(td->td_proc);
-				if ((td->td_dbgflags & TDB_STEP) != 0) {
-					td->td_frame->tf_rflags &= ~PSL_T;
-					td->td_dbgflags &= ~TDB_STEP;
-				}
-				PROC_UNLOCK(td->td_proc);
-			}
+			if ((dr6 & DBREG_DR6_BS) != 0)
+				trap_clear_step(td, frame);
 			break;
 
 		case T_ARITHTRAP:	/* arithmetic trap */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c5e2d5.1f887.65695a35>