From nobody Sun Oct 18 10:29:12 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j6vzr5FLwz6vL5p for ; Sun, 18 Oct 2026 10:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j6vzr4Hcnz4RZv for ; Sun, 18 Oct 2026 10:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792319352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRKYA73boLYftYimr/W2tQk58VThz4CvmS2QBOBcZus=; b=BPh6wBuHRHCSjploC9RJfT4w/1TVmd18MFZlusnyjIL1s7WtxR+DOF6HRZrXWeQQYVODDj Th2fk8q4epUol7s2kYRufIn96VAtFKNdl+sz3mqC6Sk9hP9ZCeIpk5GMoOtuHgeMh7YPSo Dv9MXnjV516LdIoaw7vSkEcrPzu18kk7p8NdAMOje89R5WeDqE4R8xoIMTjcsPyZa/MyKA OpUSWzAlzfjiqISxdovOASWLLT4vMNgtTS04b4P2MXrb97uo32wXGHNF5opys1y6aXlhUY rNXK7EFy2I1updcZCvvDB6mQbSDK4lkcQobTYjTkr9aHakHvVqJGh5+hN4Y1jA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792319352; b=cxpzjYXkH68UllrMEOZGzjk7d3zFz3hSCC1mbG1LyDdoc6raN7D+ADtjX57HmsQBs/RgJF ZWrUFDw56qryqMR7VCEqveni7yXVoCLJcs3SUoy42raNxLmes5Sd01YPt+DMfegqGH8S70 oIpqb93pMJ1MqsFItWJ28rwrSLXSj8APdc+LSvJhVfDJkczPb4PkTnABxIQ3OgYa2AcLvy Z0XsHdiCQX4mDUSh6KRyCyMTm2MUW+CBgiKoZoULeqkYvu/BShTfm31dchemOFyli7sskN ib/qszHfUSbrGL2NvH/8KEgmkaZm8F64QE8otTRZyUEkPtlgw322y7/9nL7PMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792319352; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jRKYA73boLYftYimr/W2tQk58VThz4CvmS2QBOBcZus=; b=XadZYnHNRPtDSes6++gSkFW1grxrTTxFhLwJt/61t1fyskLNDyLupufLUQsP2lmhB00/RX Prt8Tbva+xuMo1dPKynN/r6UcKpecqcW12Gua4WwmxViOTcknHKxaHttQADQnkcCpSd+Gx WKmvWasu5nNdfVdjorPIWqG07jzlUNMYvMGQh17ka6FEKRgfIwrcrDRDZldcgnLJY2lDBs 22TYnN9RZO+ME9bj2PpqfoNUTPsDet0xtaRdDshvn2zQX/M//7CVP51pii4vf+CPFMXXGZ HJrU0rFRw3y2ECq7TxHRFKUDt+ZuSXDdTV7LaSZzqbJCV7fEwCrVyIw3WdPH5w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j6vzr3xY5zlyK for ; Sun, 18 Oct 2026 10:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 18b36 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 18 Oct 2026 10:29:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Kubaj Subject: git: 64b2fea9a2f9 - main - powerpc: keep the VSX halves of the FPRs across back-to-back signals List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pkubaj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64b2fea9a2f90c2cc6097ed2d69acbfeeb13058d Auto-Submitted: auto-generated Date: Sun, 18 Oct 2026 10:29:12 +0000 Message-Id: <6ad49f78.18b36.743c2da9@gitrepo.freebsd.org> The branch main has been updated by pkubaj: URL: https://cgit.FreeBSD.org/src/commit/?id=64b2fea9a2f90c2cc6097ed2d69acbfeeb13058d commit 64b2fea9a2f90c2cc6097ed2d69acbfeeb13058d Author: Piotr Kubaj AuthorDate: 2026-10-15 19:18:16 +0000 Commit: Piotr Kubaj CommitDate: 2026-10-18 10:29:04 +0000 powerpc: keep the VSX halves of the FPRs across back-to-back signals grab_mcontext() only put the second halves of vs0-31 into the context while the thread owned the VSX unit, but sigreturn(2) gives ownership up so that the next use reloads the registers lazily. A signal that arrives right after a sigreturn, like one the handler's mask was holding back, got a context without them and its own sigreturn then zeroed them in the PCB. The halves saved in the PCB are current whenever the FP state is, since VSX instructions can't run without PCB_VSX and save_fpu() stores them in that case, so export them together with the FP registers. Reviewed by: jhibbits MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D60754 --- sys/powerpc/powerpc/exec_machdep.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/powerpc/powerpc/exec_machdep.c b/sys/powerpc/powerpc/exec_machdep.c index 7192feae6055..68a52c463ce3 100644 --- a/sys/powerpc/powerpc/exec_machdep.c +++ b/sys/powerpc/powerpc/exec_machdep.c @@ -422,13 +422,21 @@ grab_mcontext(struct thread *td, mcontext_t *mcp, int flags) for (i = 0; i < 32; i++) memcpy(&mcp->mc_fpreg[i], &pcb->pcb_fpu.fpr[i].fpr, sizeof(double)); - } - if (pcb->pcb_flags & PCB_VSX) { - mcp->mc_flags |= _MC_VS_VALID; - for (i = 0; i < 32; i++) - memcpy(&mcp->mc_vsxfpreg[i], - &pcb->pcb_fpu.fpr[i].vsr[2], sizeof(double)); + /* + * The second halves of VSR0-31 in the PCB are current + * whenever the FP state is: VSX instructions cannot run + * without PCB_VSX, and save_fpu() stores them when it is + * set. Export them regardless of whether the thread owns + * VSX at this moment, or a signal delivered right after a + * sigreturn loses them. + */ + if (cpu_features & PPC_FEATURE_HAS_VSX) { + mcp->mc_flags |= _MC_VS_VALID; + for (i = 0; i < 32; i++) + memcpy(&mcp->mc_vsxfpreg[i], + &pcb->pcb_fpu.fpr[i].vsr[2], sizeof(double)); + } } /*