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
alpha
arm target/arm: Do hflags rebuild in cpsr_write() 2021-08-26 17:02:01 +01:00
cris
generic
hexagon
host
hppa
i386 linux-user: fix guest/host address mixup in i386 setup_rt_frame() 2021-08-05 12:15:44 +02:00
m68k
microblaze
mips
mips64
nios2
openrisc
ppc
riscv
s390x
sh4
sparc
x86_64
xtensa
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
exit.c
fd-trans.c
fd-trans.h
flat.h
flatload.c
ioctls.h
linux_loop.h
linuxload.c
main.c
meson.build
mmap.c
qemu.h
safe-syscall.S
semihost.c
signal-common.h
signal.c
socket.h
strace.c
strace.list
syscall_defs.h
syscall_types.h
syscall.c
target_flat.h
trace-events
trace.h
uaccess.c
uname.c
uname.h
vm86.c