From 3c59a868956636bc8adafb1b168d090897692532 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 22 May 2019 15:17:12 -0400 Subject: [PATCH] fix vrregset_t layout and member naming on powerpc64 the mistaken layout seems to have been adapted from 32-bit powerpc, where vscr and vrsave are packed into the same 128-bit slot in a way that looks like it relies on non-overlapping-ness of the value bits in big endian. the powerpc64 port accounted for the fact that the 64-bit ABI puts each in its own 128-bit slot, but ordered them incorrectly (matching the bit order used on the 32-bit ABI), and failed to account for vscr being padded according to endianness so that it can be accessed via vector moves. in addition to ABI layout, our definition used different logical member layout/naming from glibc, where vscr is a structure to facilitate access as a 32-bit word or a 128-bit vector. the inconsistency here was unintentional, so fix it. --- arch/powerpc64/bits/signal.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/powerpc64/bits/signal.h b/arch/powerpc64/bits/signal.h index 34693a68..94c7a327 100644 --- a/arch/powerpc64/bits/signal.h +++ b/arch/powerpc64/bits/signal.h @@ -17,10 +17,14 @@ typedef struct { typedef struct { unsigned __int128 vrregs[32]; - unsigned _pad[3]; - unsigned vrsave; - unsigned vscr; - unsigned _pad2[3]; + struct { +#if __BIG_ENDIAN__ + unsigned _pad[3], vscr_word; +#else + unsigned vscr_word, _pad[3]; +#endif + } vscr; + unsigned vrsave, _pad[3]; } vrregset_t; typedef struct sigcontext { -- 2.25.1