aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-09-20 16:40:15 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-09-22 15:40:40 +0000
commitc6d7235ac15d208435a839bf847dd898d9b1d9fe (patch)
tree8673d9b8bc30fedafcc3b5ed288b67b8845c4fbb
parentdc975612213369f597449ced5a3c5edabc2aae6d (diff)
amd64: handle #AC in kernel mode
Recover from it if PCB_ONFAULT handler is provided. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D59815
-rw-r--r--sys/amd64/amd64/trap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 815d356217f9..f3b06a419d07 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -532,6 +532,14 @@ trap(struct trapframe *frame)
return;
switch (type) {
+ case T_ALIGNFLT:
+ if (curpcb->pcb_onfault != NULL) {
+ frame->tf_rip = (long)curpcb->pcb_onfault;
+ return;
+ }
+ trap_fatal(frame, 0);
+ return;
+
case T_PAGEFLT: /* page fault */
(void)trap_pfault(frame, false, NULL, NULL);
return;