Page MenuHomeFreeBSD

[PPC64] Fix mismatch between thread flags and MSR
ClosedPublic

Authored by luporl on Feb 12 2019, 6:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 9, 3:48 AM
Unknown Object (File)
Feb 28 2024, 8:15 AM
Unknown Object (File)
Jan 8 2024, 10:38 PM
Unknown Object (File)
Dec 20 2023, 1:13 AM
Unknown Object (File)
Nov 18 2023, 4:46 AM
Unknown Object (File)
Nov 15 2023, 12:05 AM
Unknown Object (File)
Sep 21 2023, 4:07 PM
Unknown Object (File)
Aug 26 2023, 10:53 AM

Details

Summary

When sigreturn() restored a thread's context, SRR1 was being restored
to its previous value, but pcb_flags was not being touched.

This could cause a mismatch between the thread's MSR and its pcb_flags.
For instance, when the thread used the FPU for the first time inside
the signal handler, sigreturn() would clear SRR1, but not pcb_flags.
Then, the thread would return with the FPU bit cleared in MSR and,
the next time it tried to use the FPU, it would fail on a KASSERT
that checked if the FPU was disabled.

This change clears the FPU bit in both pcb_flags and frame->srr1,
as the code that restores the context expects to use the FPU trap
to re-enable it.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Patched the build tree in the freebsd.org cluster and installed -current + this review on the pkg build server. You can track builds here when it starts spinning up in about an hour.

This looks good from the user side as the machine is humming along quite nicely. Thank you for digging into this!

This revision is now accepted and ready to land.Feb 14 2019, 12:40 PM
This revision was automatically updated to reflect the committed changes.