summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbsd <bsd@FreeBSD.org>2001-07-19 04:37:27 +0000
committerbsd <bsd@FreeBSD.org>2001-07-19 04:37:27 +0000
commit8e847a512321399ee40f1f1ec78e84d3cd35ee43 (patch)
tree68f3e83d564cef4db6f8398ca94b4e5ddfd6590d
parent7e154a8df47fef85a555745479d72a8d59f3921b (diff)
downloadFreeBSD-src-8e847a512321399ee40f1f1ec78e84d3cd35ee43.zip
FreeBSD-src-8e847a512321399ee40f1f1ec78e84d3cd35ee43.tar.gz
swtch.s: During context save, use the correct bit mask for clearing
the non-reserved bits of dr7. During context restore, load dr7 in such a way as to not disturb reserved bits. machdep.c: Don't explicitly disallow the setting of the reserved bits in dr7 since we now keep from setting them when we load dr7 from the PCB. This allows one to write back the dr7 value obtained from the system without triggering an EINVAL (one of the reserved bits always seems to be set after taking a trace trap). MFC after: 7 days
-rw-r--r--sys/amd64/amd64/cpu_switch.S10
-rw-r--r--sys/amd64/amd64/machdep.c3
-rw-r--r--sys/amd64/amd64/swtch.s10
-rw-r--r--sys/i386/i386/machdep.c3
-rw-r--r--sys/i386/i386/swtch.s10
5 files changed, 24 insertions, 12 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 180b87b..0f2f7a8 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -104,7 +104,7 @@ ENTRY(cpu_switch)
jz 1f /* no, skip over */
movl %dr7,%eax /* yes, do the save */
movl %eax,PCB_DR7(%edx)
- andl $0x0000ff00, %eax /* disable all watchpoints */
+ andl $0x0000fc00, %eax /* disable all watchpoints */
movl %eax,%dr7
movl %dr6,%eax
movl %eax,PCB_DR6(%edx)
@@ -271,7 +271,13 @@ cpu_switch_load_gs:
movl %eax,%dr1
movl PCB_DR0(%edx),%eax
movl %eax,%dr0
- movl PCB_DR7(%edx),%eax
+ movl %dr7,%eax /* load dr7 so as not to disturb */
+ andl $0x0000fc00,%eax /* reserved bits */
+ pushl %ebx
+ movl PCB_DR7(%edx),%ebx
+ andl $~0x0000fc00,%ebx
+ orl %ebx,%eax
+ popl %ebx
movl %eax,%dr7
1:
ret
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 7e9a4dd..c12e676 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -2314,9 +2314,6 @@ set_dbregs(p, dbregs)
if ((dbregs->dr7 & mask1) == mask2)
return (EINVAL);
- if (dbregs->dr7 & 0x0000fc00)
- return (EINVAL);
-
pcb = &p->p_addr->u_pcb;
/*
diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s
index 180b87b..0f2f7a8 100644
--- a/sys/amd64/amd64/swtch.s
+++ b/sys/amd64/amd64/swtch.s
@@ -104,7 +104,7 @@ ENTRY(cpu_switch)
jz 1f /* no, skip over */
movl %dr7,%eax /* yes, do the save */
movl %eax,PCB_DR7(%edx)
- andl $0x0000ff00, %eax /* disable all watchpoints */
+ andl $0x0000fc00, %eax /* disable all watchpoints */
movl %eax,%dr7
movl %dr6,%eax
movl %eax,PCB_DR6(%edx)
@@ -271,7 +271,13 @@ cpu_switch_load_gs:
movl %eax,%dr1
movl PCB_DR0(%edx),%eax
movl %eax,%dr0
- movl PCB_DR7(%edx),%eax
+ movl %dr7,%eax /* load dr7 so as not to disturb */
+ andl $0x0000fc00,%eax /* reserved bits */
+ pushl %ebx
+ movl PCB_DR7(%edx),%ebx
+ andl $~0x0000fc00,%ebx
+ orl %ebx,%eax
+ popl %ebx
movl %eax,%dr7
1:
ret
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 7e9a4dd..c12e676 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2314,9 +2314,6 @@ set_dbregs(p, dbregs)
if ((dbregs->dr7 & mask1) == mask2)
return (EINVAL);
- if (dbregs->dr7 & 0x0000fc00)
- return (EINVAL);
-
pcb = &p->p_addr->u_pcb;
/*
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 180b87b..0f2f7a8 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -104,7 +104,7 @@ ENTRY(cpu_switch)
jz 1f /* no, skip over */
movl %dr7,%eax /* yes, do the save */
movl %eax,PCB_DR7(%edx)
- andl $0x0000ff00, %eax /* disable all watchpoints */
+ andl $0x0000fc00, %eax /* disable all watchpoints */
movl %eax,%dr7
movl %dr6,%eax
movl %eax,PCB_DR6(%edx)
@@ -271,7 +271,13 @@ cpu_switch_load_gs:
movl %eax,%dr1
movl PCB_DR0(%edx),%eax
movl %eax,%dr0
- movl PCB_DR7(%edx),%eax
+ movl %dr7,%eax /* load dr7 so as not to disturb */
+ andl $0x0000fc00,%eax /* reserved bits */
+ pushl %ebx
+ movl PCB_DR7(%edx),%ebx
+ andl $~0x0000fc00,%ebx
+ orl %ebx,%eax
+ popl %ebx
movl %eax,%dr7
1:
ret
OpenPOWER on IntegriCloud