qemu-e2k/linux-user
Peter Maydell e784807cd2 target/arm: Do hflags rebuild in cpsr_write()
Currently we rely on all the callsites of cpsr_write() to rebuild the
cached hflags if they change one of the CPSR bits which we use as a
TB flag and cache in hflags.  This is a bit awkward when we want to
change the set of CPSR bits that we cache, because it means we need
to re-audit all the cpsr_write() callsites to see which flags they
are writing and whether they now need to rebuild the hflags.

Switch instead to making cpsr_write() call arm_rebuild_hflags()
itself if one of the bits being changed is a cached bit.

We don't do the rebuild for the CPSRWriteRaw write type, because that
kind of write is generally doing something special anyway.  For the
CPSRWriteRaw callsites in the KVM code and inbound migration we
definitely don't want to recalculate the hflags; the callsites in
boot.c and arm-powerctl.c have to do a rebuild-hflags call themselves
anyway because of other CPU state changes they make.

This allows us to drop explicit arm_rebuild_hflags() calls in a
couple of places where the only reason we needed to call it was the
CPSR write.

This fixes a bug where we were incorrectly failing to rebuild hflags
in the code path for a gdbstub write to CPSR, which meant that you
could make QEMU assert by breaking into a running guest, altering the
CPSR to change the value of, for example, CPSR.E, and then
continuing.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210817201843.3829-1-peter.maydell@linaro.org
2021-08-26 17:02:01 +01:00
..
aarch64 linux-user: update syscall_nr.h to Linux v5.13 2021-07-13 13:59:59 +02:00
alpha linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
arm target/arm: Do hflags rebuild in cpsr_write() 2021-08-26 17:02:01 +01:00
cris linux-user: Extract target errno to 'target_errno_defs.h' 2021-07-12 21:53:35 +02:00
generic linux-user: Extract target errno to 'target_errno_defs.h' 2021-07-12 21:53:35 +02:00
hexagon linux-user: update syscall_nr.h to Linux v5.13 2021-07-13 13:59:59 +02:00
host linux-user/: fix some comment spelling errors 2020-09-17 20:39:22 +02:00
hppa qemu/atomic: Add aligned_{int64,uint64}_t types 2021-07-21 07:45:38 -10:00
i386 linux-user: fix guest/host address mixup in i386 setup_rt_frame() 2021-08-05 12:15:44 +02:00
m68k linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
microblaze linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
mips linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
mips64 linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
nios2 linux-user: update syscall_nr.h to Linux v5.13 2021-07-13 13:59:59 +02:00
openrisc linux-user: update syscall_nr.h to Linux v5.13 2021-07-13 13:59:59 +02:00
ppc linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
riscv linux-user: update syscall_nr.h to Linux v5.13 2021-07-13 13:59:59 +02:00
s390x linux-user/s390x: signal with SIGFPE on compare-and-trap 2021-08-03 15:17:38 +02:00
sh4 linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
sparc linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
x86_64 linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
xtensa linux-user: update syscall.tbl to Linux v5.13 2021-07-13 13:59:59 +02:00
cpu_loop-common.h
elfload.c linux-user/elfload: byteswap i386 registers when dumping core 2021-08-05 12:17:30 +02:00
errnos.c.inc linux-user: Simplify host <-> target errno conversion using macros 2021-07-12 21:53:35 +02:00
exit.c tcg/plugins: implement a qemu_plugin_user_exit helper 2021-07-23 17:22:16 +01:00
fd-trans.c fd-trans: Fix race condition on reallocation of the translation table. 2021-07-12 21:54:46 +02:00
fd-trans.h fd-trans: Fix race condition on reallocation of the translation table. 2021-07-12 21:54:46 +02:00
flat.h linux-user/: fix some comment spelling errors 2020-09-17 20:39:22 +02:00
flatload.c exec: Use cpu_untagged_addr in g2h; split out g2h_untagged 2021-02-16 11:04:53 +00:00
ioctls.h linux-user: Conditionalize TUNSETVNETLE 2021-01-07 05:09:06 -10:00
linux_loop.h
linuxload.c linux-user: Fix style problems in linuxload.c 2021-07-07 21:22:35 +02:00
main.c fd-trans: Fix race condition on reallocation of the translation table. 2021-07-12 21:54:46 +02:00
meson.build linux-user/sparc: Merge sparc64/ into sparc/ 2021-05-15 21:43:23 +02:00
mmap.c linux-user: Set CF_PARALLEL when mapping shared memory 2021-06-15 08:28:56 +02:00
qemu.h linux-user: Pass CPUArchState to do_sigaltstack 2021-05-15 21:43:23 +02:00
safe-syscall.S linux-user: Extract target errno to 'target_errno_defs.h' 2021-07-12 21:53:35 +02:00
semihost.c Do not include cpu.h if it's not really necessary 2021-05-02 17:24:51 +02:00
signal-common.h linux-user: Pass CPUArchState to target_restore_altstack 2021-05-15 21:43:23 +02:00
signal.c linux-user: Let sigaction query SIGKILL/SIGSTOP 2021-06-20 16:21:01 +02:00
socket.h
strace.c linux-user: Add strace support for printing arguments of llseek 2021-05-15 21:41:47 +02:00
strace.list linux-user: Add copy_file_range to strace.list 2021-05-18 07:09:58 +02:00
syscall_defs.h linux-user: Extract target errno to 'target_errno_defs.h' 2021-07-12 21:53:35 +02:00
syscall_types.h linux-user: Add support for btrfs ioctls used to scrub a filesystem 2020-09-03 01:09:35 +02:00
syscall.c linux-user/syscall: Remove unused variable from execve 2021-07-26 07:07:28 -10:00
target_flat.h
trace-events linux-user/trace-events: fix minor typo in format string 2021-06-17 16:09:11 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
uaccess.c linux-user: Use signed lengths in uaccess.c 2021-04-07 18:55:27 +02:00
uname.c
uname.h
vm86.c linux-user: Use `qemu_log' for non-strace logging 2020-02-19 11:17:40 +01:00