git: 06d35e735d19 - stable/15 - amd64: fixes for register handling of syscall entry for FRED

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

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

commit 06d35e735d19401ec55afda4b3e5e7c24318a585
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-27 09:21:55 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-11-03 09:01:14 +0000

    amd64: fixes for register handling of syscall entry for FRED
    
    (cherry picked from commit 473cd1bba9b4e80b741769ff6185ba3846b1f050)
---
 sys/amd64/amd64/exception.S | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 0e783fe4ff00..b596a0ff1b9d 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -1428,7 +1428,7 @@ gsbase_load_fault:
 	ALIGN_TEXT
 user_fred_syscall:
 	movq	%rdx,TF_RDX(%rsp)
-	movq	%rcx,TF_RCX(%rsp)
+	movq	%r11,TF_R11(%rsp)
 	SAVE_SEGS
 	movq	PCPU(CURPCB),%r11
 	andl	$~PCB_FULL_IRET,PCB_FLAGS(%r11)
@@ -1439,6 +1439,7 @@ user_fred_syscall:
 	movq	%r9,TF_R9(%rsp)
 	movq	%rbx,TF_RBX(%rsp)
 	movq	%rbp,TF_RBP(%rsp)
+	movq	%r10,TF_RCX(%rsp)
 	movq	%r12,TF_R12(%rsp)
 	movq	%r13,TF_R13(%rsp)
 	movq	%r14,TF_R14(%rsp)
@@ -1462,10 +1463,11 @@ user_fred_syscall:
 	movq	TF_RSI(%rsp),%rsi
 	movq	TF_RDX(%rsp),%rdx
 	movq	TF_RAX(%rsp),%rax
+	movq	TF_RIP(%rsp),%rcx
+	movq	TF_RFLAGS(%rsp),%r11
 	xorl	%r8d,%r8d
 	xorl	%r9d,%r9d
 	xorl	%r10d,%r10d
-	xorl	%r11d,%r11d
 	addq	$TF_ERR,%rsp
 	.globl	fred_syscall_eretu
 fred_syscall_eretu: