qemu/target/sh4
Peter Maydell 525650cd71 target/sh4: Avoid shift into sign bit in update_itlb_use()
In update_itlb_use() the variables or_mask and and_mask are uint8_t,
which means that in expressions like "and_mask << 24" the usual C
arithmetic conversions will result in the shift being done as a
signed int type, and so we will shift into the sign bit. For QEMU
this isn't undefined behaviour because we use -fwrapv; but we can
avoid it anyway by using uint32_t types for or_mask and and_mask.

Resolves: Coverity CID 1547628
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Message-id: 20240723172431.1757296-1-peter.maydell@linaro.org
2024-07-29 17:00:20 +01:00
..
Kconfig sh4: select correct components for no-board build 2024-05-10 15:45:14 +02:00
cpu-param.h target/sh4: Remove `NB_MMU_MODES` define 2023-03-13 06:44:37 -07:00
cpu-qom.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
cpu.c target: Set TCGCPUOps::cpu_exec_halt to target's has_work implementation 2024-07-11 11:41:34 +01:00
cpu.h target/sh4: Merge mach and macl into a union 2024-04-09 07:43:31 -10:00
gdbstub.c target/sh4: Prefer fast cpu_env() over slower CPU QOM cast macro 2024-03-12 12:04:24 +01:00
helper.c target/sh4: Avoid shift into sign bit in update_itlb_use() 2024-07-29 17:00:20 +01:00
helper.h target/sh4: Fix mac.w with saturation enabled 2024-04-09 07:43:31 -10:00
meson.build meson: Rename target_softmmu_arch -> target_system_arch 2023-10-07 19:03:07 +02:00
monitor.c hmp: Pass monitor to mon_get_cpu_env() 2020-11-13 12:45:51 +00:00
op_helper.c target/sh4: Fix mac.w with saturation enabled 2024-04-09 07:43:31 -10:00
translate.c accel/tcg: Provide default implementation of disas_log 2024-05-15 08:55:18 +02:00