glibc/sysdeps/unix/sysv/linux/sh
mirabilos f42634f824 sh4: ensure FPSCR.PR==0 when executing FRCHG [BZ #27543]
If the bit is not 0, the operations FRCHG and FSCHG are
undefined and cause a trap; qemu now checks for this as
well, so we set it to 0 temporarily and restore the old
value in getcontext afterwards (setcontext/swapcontext
already do so).

From the discussion in the bugreport, this can probably
be optimised in one place but none of the people involved
are SH4 assembly experts, this patch is field-tested, and
it’s not a code path run often. The other question, what
happens if a signal occurs while the bit is temporarily 0,
is also still unsolved, but to fix that a kernel change is
most likely needed; this patch changes a certain trap on
many CPUs for a hard-to-get trap in a signal handler if a
signal is delivered during the few instructions the PR bit
is temporarily set to 0, so it’s not a regression for most
users.

See BZ and https://bugs.launchpad.net/qemu/+bug/1796520 for
related discussion, references and review comments.

Signed-off-by: mirabilos <tg@debian.org>
Reviewed-by: Oleg Endo <olegendo@gcc.gnu.org>
Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-01-13 11:25:23 -03:00
..
be Implement C23 atan2pi 2024-12-12 20:57:44 +00:00
bits Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
le Implement C23 atan2pi 2024-12-12 20:57:44 +00:00
sh3 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sh4 sh4: ensure FPSCR.PR==0 when executing FRCHG [BZ #27543] 2025-01-13 11:25:23 -03:00
sys Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
adaptive_spin_count.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
arch-syscall.h Update syscall lists for Linux 6.10 2024-07-30 08:48:51 -03:00
atomic-machine.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
c++-types.data SH: Consolidate nptl/ subdirectories under linux/..... 2014-06-23 09:23:12 -07:00
clone.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
configure configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
configure.ac Move architecture cases out of sysdeps/unix/sysv/linux/configure.ac. 2014-06-24 20:53:03 +00:00
fanotify_mark.c linux: Add fanotify_mark C implementation 2021-11-25 09:56:57 -03:00
Implies NPTL is no longer an add-on! 2014-07-07 09:29:06 -07:00
kernel-features.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
kernel_sigaction.h m68k: Fix sigaction kernel definition (BZ #23960) 2018-12-18 16:45:10 -02:00
kernel_stat.h linux: Set default kernel_stat.h to LFS 2021-02-11 07:58:05 -03:00
localplt.data elf: Rework exception handling in the dynamic loader [BZ #25486] 2022-11-03 09:39:31 +01:00
lowlevel-atomic.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
makecontext.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Makefile SH: ____longjmp_chk for GNU/Linux with sigaltstack support. 2012-06-23 11:56:02 +02:00
pointer_guard.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
shlib-versions Move malloc hooks into a compat DSO 2021-07-22 18:37:59 +05:30
sigaltstack-offsets.sym SH: ____longjmp_chk for GNU/Linux with sigaltstack support. 2012-06-23 11:56:02 +02:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscall.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscall_cancel.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
syscalls.list linux: Add prlimit64 C implementation 2021-11-30 13:13:03 -03:00
sysdep.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sysdep.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
time64-compat.h y2038: Add support for 64-bit time on legacy ABIs 2021-06-15 10:42:11 -03:00
Versions Linux: Move wordsize-32 Version to default 2023-02-20 10:19:25 -03:00
vfork.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
xstatver.h Linux: make generic xstatver.h the default one 2022-12-07 14:40:36 -03:00