git: 6ca697360b53 - main - amd64 FRED: no need to store fs/gsbase on user_fred_not_syscall path

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 01:35:01 UTC
The branch main has been updated by kib:

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

commit 6ca697360b53ce4f952d2b178c5d34f75f8c50ec
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-29 01:01:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-29 01:33:47 +0000

    amd64 FRED: no need to store fs/gsbase on user_fred_not_syscall path
    
    The stores are only relevant for PCB_FULL_IRET return to userspace,
    and setting the flag stores the bases into the pcb anyway.  Also, the
    hidden issue is that FRED already did implicit SWAPGS on entry, so
    stored gsbase was wrong anyway.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
---
 sys/amd64/amd64/exception.S | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 1fa797cf5d9e..6ec37032bc05 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -1488,12 +1488,6 @@ user_fred_non_syscall:
 	movq	%r14,TF_R14(%rsp)
 	movq	%r15,TF_R15(%rsp)
 	SAVE_SEGS
-	movq	PCPU(CURTHREAD),%r9
-	movq	TD_PCB(%r9),%r8
-	rdfsbase %rax
-	movq	%rax,PCB_FSBASE(%r8)
-	rdgsbase %rax
-	movq	%rax,PCB_GSBASE(%r8)
 	movl	$TF_HASSEGS,TF_FLAGS(%rsp)
 	KMSAN_ENTER
 	movq	%rsp, %rdi