linux/arch/sh/include
Rich Felker bbe6c77857 sh: make sigcontext definition consistent across fpu/nofpu models
Up until now, the SH version of the sigcontext structure, and thus
mcontext_t/ucontext_t, varied depending on the cpu model the kernel
was built to run on. SH-4 (including SH-4A) and SH-2A used the form
with space for FPU registers, and everything else used a form that
omitted them.

From a userspace perspective, however, the structure layout must be
fixed for a given ABI. Traditionally glibc and uClibc used the form
with space for FPU registers only when __SH4__ (which implies FPU;
__SH4_NOFPU__ is the predefined macro for SH-4 but with no-FPU ABI)
was defined. As a result:

- SH-4 no-FPU programs never matched kernel sigcontext.

- SH-3 programs did not match kernel sigcontext if run on SH-4,
  despite an apparent intent that they be compatible.

- SH-2 and SH-2A programs (using uClibc) did not match kernel
  sigcontext if run on SH-2A.

The mismatch might seem inconsequential because it occurs at the end
of the sigcontext structure, but sigcontext is embedded as uc_mcontext
in ucontext_t, where it is followed by uc_sigmask, an important member
for signal handlers to have access to. In particular, access to
uc_sigmask is necessary for a correct implementation of thread
cancellation.

It would be possible to retain support for both sigcontext ABIs via a
personality mechanism, but since many configurations were already
broken and nobody noticed, and since there are very few if any users
of legacy no-FPU models anymore, I have opted to just remove the
variation and always include space for the FPU registers in
sigcontext. This was proposed and discussed on a thread "SH sigcontext
ABI is broken" cross-posted to linux-sh, libc-alpha, and musl libc
lists in June 2015, and no objections were raised.

Signed-off-by: Rich Felker <dalias@libc.org>
2016-07-31 03:33:32 +00:00
..
asm sh: cmpxchg: fix a bit shift bug in big_endian os 2016-07-31 03:33:32 +00:00
cpu-common/cpu sh: Remove unused sh_pfc_register_info() function 2013-01-25 09:24:30 +09:00
cpu-sh2/cpu sh: prefix sh-specific "CCR" and "CCR2" by "SH_" 2014-03-04 07:55:49 -08:00
cpu-sh2a/cpu sh: prefix sh-specific "CCR" and "CCR2" by "SH_" 2014-03-04 07:55:49 -08:00
cpu-sh3/cpu sh: prefix sh-specific "CCR" and "CCR2" by "SH_" 2014-03-04 07:55:49 -08:00
cpu-sh4/cpu sh: remove CPU_SUBTYPE_SH7764 2014-08-06 18:01:12 -07:00
cpu-sh4a/cpu sh: remove CPU_SUBTYPE_SH7764 2014-08-06 18:01:12 -07:00
cpu-sh5/cpu sh: Tidy up some of the cpu legacy dma header mess. 2012-05-19 18:30:31 +09:00
mach-common/mach gpio: Include linux/gpio.h instead of asm/gpio.h 2016-02-16 00:20:03 +01:00
mach-dreamcast/mach sh: Kill off MAX_DMA_ADDRESS leftovers. 2012-05-19 18:50:09 +09:00
mach-ecovec24/mach UAPI: (Scripted) Convert #include "..." to #include <path/...> in kernel system headers 2012-10-02 18:01:25 +01:00
mach-kfr2r09/mach sh: kfr2r09: Use lv5207lp backlight 2013-07-17 10:06:18 +09:00
mach-landisk/mach sh: landisk evt2irq migration. 2012-05-18 16:51:36 +09:00
mach-migor/mach fbdev: sh_mobile_lcdc: Remove board configuration board_data field 2012-03-12 22:40:49 +01:00
mach-sdk7786/mach sh: mach-sdk7786: Handle baseboard NMI source selection. 2010-12-17 18:58:04 +09:00
mach-se/mach Merge branch 'sh/dynamic-irq-cleanup' into sh-latest 2012-06-13 12:12:41 +09:00
mach-sh03/mach
mach-x3proto/mach sh: mach-x3proto: Support for baseboard GPIOs. 2010-10-04 02:59:29 +09:00
uapi/asm sh: make sigcontext definition consistent across fpu/nofpu models 2016-07-31 03:33:32 +00:00