qemu-e2k/target
Peter Maydell 7f3a3d3dc4 target/arm: Define and use new load_cpu_field_low32()
In several places in the 32-bit Arm translate.c, we try to use
load_cpu_field() to load from a CPUARMState field into a TCGv_i32
where the field is actually 64-bit. This works on little-endian
hosts, but gives the wrong half of the register on big-endian.

Add a new load_cpu_field_low32() which loads the low 32 bits
of a 64-bit field into a TCGv_i32. The new macro includes a
compile-time check against accidentally using it on a field
of the wrong size. Use it to fix the two places in the code
where we were using load_cpu_field() on a 64-bit field.

This fixes a bug where on big-endian hosts the guest would
crash after executing an ERET instruction, and a more corner
case one where some UNDEFs for attempted accesses to MSR
banked registers from Secure EL1 might go to the wrong EL.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230424153909.1419369-2-peter.maydell@linaro.org
2023-05-02 15:47:41 +01:00
..
alpha target/alpha: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
arm target/arm: Define and use new load_cpu_field_low32() 2023-05-02 15:47:41 +01:00
avr target/avr: Avoid use of tcg_const_i32 throughout 2023-03-13 06:44:37 -07:00
cris target/cris: Avoid use of tcg_const_i32 throughout 2023-03-13 06:44:37 -07:00
hexagon Hexagon (target/hexagon) Add overrides for cache/sync/barrier instructions 2023-04-21 09:32:52 -07:00
hppa target/hppa: Avoid use of tcg_const_i32 throughout 2023-03-13 06:44:37 -07:00
i386 target/i386: Add support for PREFETCHIT0/1 in CPUID enumeration 2023-04-28 12:50:34 +02:00
loongarch target/loongarch: Enables plugins to get instruction codes 2023-04-04 19:33:23 +08:00
m68k target/m68k: Use tcg_constant_i32 in gen_ea_mode 2023-03-13 07:03:39 -07:00
microblaze target/microblaze: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
mips target/mips: tcg: detect out-of-bounds accesses to cpu_gpr and cpu_gpr_hi 2023-04-20 11:17:35 +02:00
nios2 target/nios2: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
openrisc target/openrisc: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
ppc target/ppc: Fix temp usage in gen_op_arith_modw 2023-04-09 19:21:27 +02:00
riscv target/riscv: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
rx target/rx: Avoid tcg_const_i32 2023-03-13 06:44:37 -07:00
s390x s390x/gdb: Split s390-virt.xml 2023-04-28 08:05:37 +02:00
sh4 target/sh4: Honor QEMU_LOG_FILENAME with QEMU_LOG=cpu 2023-03-16 10:31:25 +01:00
sparc tcg/sparc: Avoid tcg_const_tl in gen_edge 2023-03-13 06:44:37 -07:00
tricore target/tricore: Use min/max for saturate 2023-03-13 07:03:39 -07:00
xtensa target/xtensa: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
Kconfig hw/loongarch: Add support loongson3 virt machine type. 2022-06-06 18:09:03 +00:00
meson.build target/loongarch: Add target build suport 2022-06-06 18:09:03 +00:00