x86: use x86_clear_dbregs() on fork

instead of manual zeroing of the debug registers file in pcb.
This centralizes the cleaning code, but the practical difference is
that PCB_DBREGS flag is cleared, saving some operations on context
switching.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29687
This commit is contained in:
Konstantin Belousov 2021-04-10 02:20:55 +03:00
parent a8b75a57c9
commit 290b0d123a
2 changed files with 2 additions and 12 deletions

View File

@ -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;

View File

@ -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;