diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2026-10-29 00:57:52 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2026-10-29 01:33:47 +0000 |
| commit | 837bb27c93a58a2df2f5203393ffa245b93caf31 (patch) | |
| tree | 8228f5c0422aaf5056edb8924ccf7e1e60db50db | |
| parent | 1c25a7f1cb2986901957cc1cdf7a0c0f99748a35 (diff) | |
amd64 FRED: clear %dr6 on #DB from kernel
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
| -rw-r--r-- | sys/amd64/amd64/trap.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 480728e9749f..d59b689c56b6 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1785,6 +1785,14 @@ trap_fred_handle_k_exc(struct thread *td, struct trapframe_fred *frame, case IDT_DE: break; case IDT_DB: + /* + * Clear %dr6 when #DB trapped from kernel mode, so + * that PT_GETDBREGS does not report stale value. FRED updates + * %dr6 despite providing the same information in the + * tf_fred_evdata field. + */ + load_dr6(0); + if (user_dbreg_trap(frame->tf_fred_evdata)) return; /* FALLTHROUGH */ |
