aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64
diff options
context:
space:
mode:
authorBrian S. Dean <bsd@FreeBSD.org>2000-02-28 19:48:51 +0000
committerBrian S. Dean <bsd@FreeBSD.org>2000-02-28 19:48:51 +0000
commit2265d5e30dd81e9fdef4dad9bcb0f47f314bf186 (patch)
treee55fcbca5cf9d49805c5df89fa7b99b5571ec9d1 /sys/amd64
parentb3f1e629e915f510fdbcfae6a5af7dcf0ba7162c (diff)
Notes
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/machdep.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 1efc7e48f8e8..c204fbeeb72e 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1031,6 +1031,28 @@ setregs(p, entry, stack, ps_strings)
else
pcb->pcb_gs = _udatasel;
+ /*
+ * Reset the hardware debug registers if they were in use.
+ * They won't have any meaning for the newly exec'd process.
+ */
+ if (pcb->pcb_flags & PCB_DBREGS) {
+ pcb->pcb_dr0 = 0;
+ pcb->pcb_dr1 = 0;
+ pcb->pcb_dr2 = 0;
+ pcb->pcb_dr3 = 0;
+ pcb->pcb_dr6 = 0;
+ pcb->pcb_dr7 = 0;
+ if (pcb == curpcb) {
+ /*
+ * Clear the debug registers on the running
+ * CPU, otherwise they will end up affecting
+ * the next process we switch to.
+ */
+ reset_dbregs();
+ }
+ pcb->pcb_flags &= ~PCB_DBREGS;
+ }
+
/*
* Initialize the math emulator (if any) for the current process.
* Actually, just clear the bit that says that the emulator has