git: 6a83ecfe812e - main - powerpc: don't save the FPU state again in freebsd32_sigreturn()

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Sat, 21 Nov 2026 17:39:53 UTC
The branch main has been updated by pkubaj:

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

commit 6a83ecfe812ea97f06b3d3640edb41c7dfa8702e
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2026-09-23 09:29:10 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2026-11-21 17:39:43 +0000

    powerpc: don't save the FPU state again in freebsd32_sigreturn()
    
    set_mcontext32() restores the floating point registers from the context,
    then freebsd32_sigreturn() called save_fpu(), which writes the hardware
    registers, the ones the signal handler left behind, back into the PCB.
    The process resumed with the handler's registers instead of its own.
    sys_sigreturn() has no such call; drop it here too.
    
    A 32-bit program that loads f14, takes a signal whose handler loads
    another value and reads f14 back got the handler's value on a
    COMPAT_FREEBSD32 kernel; it gets its own now, like the 64-bit build.
    
    Reviewed by:    jhibbits
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D61792
---
 sys/powerpc/powerpc/exec_machdep.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c
index d7166b13f67d..d66afe02a9d1 100644
--- a/sys/powerpc/powerpc/exec_machdep.c
+++ b/sys/powerpc/powerpc/exec_machdep.c
@@ -938,13 +938,6 @@ freebsd32_sigreturn(struct thread *td, struct freebsd32_sigreturn_args *uap)
 	if (error != 0)
 		return (error);
 
-	/*
-	 * Save FPU state if needed. User may have changed it on
-	 * signal handler
-	 */
-	if (uc.uc_mcontext.mc_srr1 & PSL_FP)
-		save_fpu(td);
-
 	kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0);
 
 	CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x",