git: 77a99f36ba4f - stable/15 - amd64: handle #AC in kernel mode

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 29 Sep 2026 00:31:54 UTC
The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=77a99f36ba4f86e667070cc79afce9ab771ec641

commit 77a99f36ba4f86e667070cc79afce9ab771ec641
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-09-20 16:40:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-09-29 00:27:14 +0000

    amd64: handle #AC in kernel mode
    
    (cherry picked from commit c6d7235ac15d208435a839bf847dd898d9b1d9fe)
---
 sys/amd64/amd64/trap.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index 38b7317182a8..d9c078428399 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;