Page MenuHomeFreeBSD

powerpc: Fix inconsistent Altivec handling in set_mcontext
ClosedPublic

Authored by sanastasio_raptorengineering.com on Oct 31 2023, 8:34 PM.
Referenced Files
Unknown Object (File)
Tue, Oct 22, 10:41 AM
Unknown Object (File)
Oct 7 2024, 2:29 PM
Unknown Object (File)
Oct 7 2024, 2:29 PM
Unknown Object (File)
Oct 7 2024, 2:29 PM
Unknown Object (File)
Oct 7 2024, 2:00 PM
Unknown Object (File)
Oct 2 2024, 5:45 AM
Unknown Object (File)
Sep 30 2024, 11:05 AM
Unknown Object (File)
Sep 30 2024, 7:22 AM

Details

Summary
powerpc: Fix inconsistent Altivec handling in set_mcontext

When support for fpu_kern_enter/fpu_kern_leave was added to powerpc,
set_mcontext was updated to handle Altivec state restoration in the same
way that the FPU state by lazily restoring the context on the first
trap. However the function was not correctly updated to unconditionally
clear the PCB_VEC and PSL_VEC bits from the pcb's flags and srr1
respectively which can sometimes result in a mismatch between a
process's MSR[VEC] state and its pcb_flags.

Fix this by simply clearing the VEC flags unconditionally in
set_mcontext, which is already done for FPU/VSX.

Fixes: a6662c37b6ffe ("powerpc: Implement fpu_kern_enter/fpu_kern_leave")
Test Plan

The fix was tested on a previously-failing CI test case and was confirmed to fix the issue. (https://ci.freebsd.org/view/Test/job/FreeBSD-main-powerpc64-test/1075/consoleText)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable