aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/include
diff options
context:
space:
mode:
authorBrandon Bergren <bdragon@FreeBSD.org>2020-12-03 01:39:59 +0000
committerBrandon Bergren <bdragon@FreeBSD.org>2020-12-03 01:39:59 +0000
commit3de50be851fefcfbca7a2cdecb1e86305cc2531d (patch)
tree7cc353eeaaac50317b8286650c5f8a7dd40388c7 /sys/powerpc/include
parent3921dc1304ee6eea27463fbb0e2acc31ea881403 (diff)
downloadsrc-3de50be851fefcfbca7a2cdecb1e86305cc2531d.tar.gz
src-3de50be851fefcfbca7a2cdecb1e86305cc2531d.zip
[PowerPC64LE] Fix LE VSX/fpr interop
In the PCB struct, we need to match the VSX register file layout correctly, as the VSRs shadow the FPRs. In LE, we need to have a dword of padding before the fprs so they end up on the correct side, as the struct may be manipulated by either the FP routines or the VSX routines. Additionally, when saving and restoring fprs, we need to explicitly target the fpr union member so it gets offset correctly on LE. Fixes weirdness with FP registers in VSX-using programs (A FPR that was saved by the FP routines but restored by the VSX routines was becoming 0 due to being loaded to the wrong side of the VSR.) Original patch by jhibbits. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D27431
Notes
Notes: svn path=/head/; revision=368290
Diffstat (limited to 'sys/powerpc/include')
-rw-r--r--sys/powerpc/include/pcb.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/powerpc/include/pcb.h b/sys/powerpc/include/pcb.h
index 386c7e2a26e3..bff58cfa7bb3 100644
--- a/sys/powerpc/include/pcb.h
+++ b/sys/powerpc/include/pcb.h
@@ -37,6 +37,8 @@
#ifndef _MACHINE_PCB_H_
#define _MACHINE_PCB_H_
+#include <sys/endian.h>
+
#include <machine/setjmp.h>
#ifndef _STANDALONE
@@ -62,8 +64,16 @@ struct pcb {
#define PCB_CFSCR 0x40 /* Process had FSCR updated */
struct fpu {
union {
+#if _BYTE_ORDER == _BIG_ENDIAN
double fpr;
uint32_t vsr[4];
+#else
+ uint32_t vsr[4];
+ struct {
+ double padding;
+ double fpr;
+ };
+#endif
} fpr[32];
double fpscr; /* FPSCR stored as double for easier access */
} pcb_fpu; /* Floating point processor */