git: f06f6654303a - stable/13 - x86: use x86_clear_dbregs() on fork

Konstantin Belousov kib at FreeBSD.org
Fri Apr 23 11:15:13 UTC 2021


The branch stable/13 has been updated by kib:

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

commit f06f6654303acc8ac5957b01787582b5d1e26a0f
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-04-09 23:20:55 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-04-23 11:14:08 +0000

    x86: use x86_clear_dbregs() on fork
    
    (cherry picked from commit 290b0d123ae2136ad84b268cd1884b1624d1d37f)
---
 sys/amd64/amd64/vm_machdep.c | 7 +------
 sys/i386/i386/vm_machdep.c   | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 98d212dc8771..1acc5dc55c85 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -230,12 +230,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 	copy_thread(td1, td2);
 
 	/* Reset debug registers in the new process */
-	pcb2->pcb_dr0 = 0;
-	pcb2->pcb_dr1 = 0;
-	pcb2->pcb_dr2 = 0;
-	pcb2->pcb_dr3 = 0;
-	pcb2->pcb_dr6 = 0;
-	pcb2->pcb_dr7 = 0;
+	x86_clear_dbregs(pcb2);
 
 	/* Point mdproc and then copy over p1's contents */
 	mdp2 = &p2->p_md;
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index ed40ebe5d1c8..57377575b9bf 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -242,12 +242,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 	copy_thread(td1, td2);
 
 	/* Reset debug registers in the new process */
-	pcb2->pcb_dr0 = 0;
-	pcb2->pcb_dr1 = 0;
-	pcb2->pcb_dr2 = 0;
-	pcb2->pcb_dr3 = 0;
-	pcb2->pcb_dr6 = 0;
-	pcb2->pcb_dr7 = 0;
+	x86_clear_dbregs(pcb2);
 
 	/* Point mdproc and then copy over td1's contents */
 	mdp2 = &p2->p_md;


More information about the dev-commits-src-all mailing list