Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 May 2021 00:39:11 GMT
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: 71add7877a02 - stable/12 - x86: use x86_clear_dbregs() on fork
Message-ID:  <202105010039.1410dBE7048253@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kib:

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

commit 71add7877a02dffa93883cc1b83542bc540645f4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-04-09 23:20:55 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-05-01 00:38:29 +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 5b3845e5c68e..da7f58d4fd3c 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -182,12 +182,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 	    cpu_max_ext_state_size);
 
 	/* 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;
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c
index c76074f5446d..8f1b0a971f58 100644
--- a/sys/i386/i386/vm_machdep.c
+++ b/sys/i386/i386/vm_machdep.c
@@ -193,12 +193,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
 	    cpu_max_ext_state_size);
 
 	/* 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202105010039.1410dBE7048253>