Page MenuHomeFreeBSD

powerpc: keep the VSX halves of the FPRs across back-to-back signals
Needs ReviewPublic

Authored by pkubaj on Thu, Oct 15, 7:34 PM.
Tags
None
Referenced Files
F176137589: D60754.id190002.diff
Fri, Oct 16, 9:56 AM
F176136895: D60754.id.diff
Fri, Oct 16, 9:47 AM
F176123409: D60754.id189989.diff
Fri, Oct 16, 7:19 AM
F176112928: D60754.id189989.diff
Fri, Oct 16, 5:24 AM
F176112263: D60754.id190002.diff
Fri, Oct 16, 5:16 AM
F176101143: D60754.diff
Fri, Oct 16, 3:02 AM
F176096387: D60754.diff
Fri, Oct 16, 2:03 AM
F176095660: D60754.id190002.diff
Fri, Oct 16, 1:55 AM
Subscribers

Details

Reviewers
None
Group Reviewers
PowerPC
Summary

grab_mcontext() only copies the second halves of vs0-31 into the context while the thread owns the VSX unit, but sigreturn(2) gives up ownership so that the next use reloads the registers lazily. So a signal that comes right after a sigreturn, like one the handler's mask was holding back, gets a context without them, and its own sigreturn then zeroes them in the PCB.

The halves in the PCB are current whenever the FP state is: VSX instructions can't run without PCB_VSX, and save_fpu() stores them in that case. So just export them together with the FP registers.

I noticed this with a small test that keeps a pattern in vs20 across two back-to-back signals, the low half came back as zero. There are a few more problems in the same area (grab_mcontext() dropping FPU ownership, the red zone not fitting a MINSIGSTKSZ stack, VSCR on little endian, VRSAVE never being switched), I'll send those separately.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped