diff options
author | peter <peter@FreeBSD.org> | 2004-01-29 00:05:03 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2004-01-29 00:05:03 +0000 |
commit | 1f9d5a9d5fb323fc72057b0605a363cb99920628 (patch) | |
tree | a893bb7eaa592aa079eaec20f61d98347d1165b3 /sys/amd64 | |
parent | 84101901e9d393c6be56bb9bfd1433025c10eee0 (diff) | |
download | FreeBSD-src-1f9d5a9d5fb323fc72057b0605a363cb99920628.zip FreeBSD-src-1f9d5a9d5fb323fc72057b0605a363cb99920628.tar.gz |
Re-add user_dbreg_trap() for debug register support
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/trap.c | 19 | ||||
-rw-r--r-- | sys/amd64/include/md_var.h | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index afea999..42fc794 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -397,6 +397,25 @@ trap(frame) case T_TRCTRAP: /* trace trap */ /* + * Ignore debug register trace traps due to + * accesses in the user's address space, which + * can happen under several conditions such as + * if a user sets a watchpoint on a buffer and + * then passes that buffer to a system call. + * We still want to get TRCTRAPS for addresses + * in kernel space because that is useful when + * debugging the kernel. + */ + if (user_dbreg_trap()) { + /* + * Reset breakpoint bits because the + * processor doesn't + */ + /* XXX check upper bits here */ + load_dr6(rdr6() & 0xfffffff0); + goto out; + } + /* * FALLTHROUGH (TRCTRAP kernel mode, kernel address) */ case T_BPTFLT: diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h index 2bebb0e..9e0ab9e 100644 --- a/sys/amd64/include/md_var.h +++ b/sys/amd64/include/md_var.h @@ -69,6 +69,7 @@ void pagezero(void *addr); int is_physical_memory(vm_offset_t addr); int isa_nmi(int cd); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); +int user_dbreg_trap(void); void fpstate_drop(struct thread *td); #endif /* !_MACHINE_MD_VAR_H_ */ |