git: efb0c54c7694 - main - amd64 FRED: handle in-kernel faults same as IDT
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Oct 2026 01:34:57 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=efb0c54c7694798214a2c130ec8461a34444e1c4
commit efb0c54c7694798214a2c130ec8461a34444e1c4
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-28 13:58:49 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-29 01:33:47 +0000
amd64 FRED: handle in-kernel faults same as IDT
Pass #MC and #DF directly to corresponding handlers, avoiding EFI
pcb_onfault case.
If a fault occurs while kdb/ddb is active, handler must call
kdb_reenter() and not do the normal processing, which typically ends up
in panic() for kernel-mode faults. But #MC and #DF should be excluded
there as well.
NMI is not an exception, it is delivered as specific event.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/amd64/amd64/trap.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 08485c852cac..f6b595d85af7 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -1766,8 +1766,17 @@ trap_fred_handle_k_exc(struct thread *td, struct trapframe_fred *frame,
* there is no sense to enable interrupts.
*/
- if (exc != IDT_PF && trap_check_pcb_onfault(td, &frame->tf_idt))
- return;
+ if (exc != IDT_DF && exc != IDT_MC) {
+#ifdef KDB
+ if (kdb_active) {
+ kdb_reenter();
+ return;
+ }
+#endif
+ if (exc != IDT_PF && trap_check_pcb_onfault(td,
+ &frame->tf_idt))
+ return;
+ }
switch (exc) {
case IDT_DE: