git: 0ecc788089b9 - stable/15 - amd64 FRED: explain why %rax is saved early

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Tue, 03 Nov 2026 09:02:18 UTC
The branch stable/15 has been updated by kib:

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

commit 0ecc788089b932d097bb1ccad81ba064443c87db
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-29 01:16:49 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-03 09:01:17 +0000

    amd64 FRED: explain why %rax is saved early
    
    (cherry picked from commit 6105e8589b2cd7f9001df045392c30fc86900633)
---
 sys/amd64/amd64/exception.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index b0ed398a36b4..e7e91cded2fc 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -1639,6 +1639,10 @@ fred_eretu_fault:
 	.globl	fred_events_handlers, fred_events_handlers_end
 fred_events_handlers:
 	subq	$TF_ERR,%rsp
+	/*
+	 * %rax is saved early both to provide a free register and to
+	 * show the right syscall number in ddb backtrace.
+	 */
 	movq	%rax,TF_RAX(%rsp)
 	movq	%rdi,TF_RDI(%rsp)
 	movq	%rsi,TF_RSI(%rsp)