git: e86a612d77ab - main - trap_fred_handle_k_exc(): handle #AC in kernel

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 27 Oct 2026 12:01:17 UTC
The branch main has been updated by kib:

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

commit e86a612d77ab34ecd96cce5fd0732999ffdd7fc0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-27 08:58:44 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-27 11:58:48 +0000

    trap_fred_handle_k_exc(): handle #AC in kernel
    
    Fixes:  c6d7235ac15d ("amd64: handle #AC in kernel mode")
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/amd64/amd64/trap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c
index f3b06a419d07..044d44d9e8f2 100644
--- a/sys/amd64/amd64/trap.c
+++ b/sys/amd64/amd64/trap.c
@@ -1815,6 +1815,10 @@ trap_fred_handle_k_exc(struct thread *td, struct trapframe_fred *frame,
 	case IDT_MF:
 		break;
 	case IDT_AC:
+		if (curpcb->pcb_onfault != NULL) {
+			frame->tf_idt.tf_rip = (long)curpcb->pcb_onfault;
+			return;
+		}
 		break;
 	case IDT_MC:
 		mca_intr();