opnsense-src/sys/powerpc
Timothy Pearson 077e30e61d powerpc: Fix multiple issues with FP/VSX save/restore
Multiple issues existed within the powerpc FP/VSX save/restore functionality,
leading to register corruption and loss of register contents in specific
scenarios involving high signal load and use of both floating point and VSX
instructions.

Issue #1

On little endian systems the PCB used the wrong location for the shadowed
FP register within the larger VSX register.  This appears to have been an
attempt to correct issue #2 without understanding how the vector load/store
instructions actually operate.

Issue #2

On little endian systems, the VSX state save/restore routines swapped 32-bit
words within the 64-bit aliased double word for the associated floating point
register.  This was due to the use of a word-oriented load/store vs. doubleword
oriented load/store.

Issue #3

The FPU was turned off in the PCB but not in hardware, leading to a potential
race condition if the same thread was scheduled immediately after sigreturn.

The triggering codebase for this is Go, which makes heavy use of signals and
and generates an unusual mix of floating point and VSX assembler.  As a result,
when combined with th powerpc lazy FPU restore, a condition was repeatedly hit
whereby the thread was interrupted in FP+VSX mode, then restored in FP only
mode, thus reliably triggering the issues above.

Also clean up the associated asm() style issue flagged by GitHub Actions.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1756
2025-07-13 14:00:56 -04:00
..
aim pmap: Degrade pmap_page_set_attr*() into a no-op on same attribute 2025-07-13 16:13:25 +09:00
amigaone sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
booke powerpc: add missing header 2025-04-21 00:50:37 -05:00
conf powerpc: Enable VIMAGE on more kernel configs 2025-05-20 12:09:29 +08:00
cpufreq newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
fpu sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
include powerpc: Fix multiple issues with FP/VSX save/restore 2025-07-13 14:00:56 -04:00
mambo Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
mikrotik sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
mpc85xx gpio: attach gpiobus when the controller is ready 2025-07-04 16:56:00 +03:00
ofw machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00
powermac newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
powernv newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
powerpc powerpc: Fix multiple issues with FP/VSX save/restore 2025-07-13 14:00:56 -04:00
ps3 newbus: replace leftover device unit wildcards 2025-06-21 05:57:45 +03:00
pseries Replace calls to bus_generic_attach with bus_attach_children 2024-12-06 17:26:16 -05:00
psim machine/stdarg.h -> sys/stdarg.h 2025-06-11 17:39:02 +01:00