qemu-e2k/target/i386/tcg
Richard Henderson b5e0d5d22f target/i386: Fix 32-bit wrapping of pc/eip computation
In 32-bit mode, pc = eip + cs_base is also 32-bit, and must wrap.
Failure to do so results in incorrect memory exceptions to the guest.
Before 732d548732, this was implicitly done via truncation to
target_ulong but only in qemu-system-i386, not qemu-system-x86_64.

To fix this, we must add conditional zero-extensions.
Since we have to test for 32 vs 64-bit anyway, note that cs_base
is always zero in 64-bit mode.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2022
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20231212172510.103305-1-richard.henderson@linaro.org>
2023-12-12 13:35:08 -08:00
..
sysemu accel/tcg: Replace CPUState.env_ptr with cpu_env() 2023-10-04 11:03:54 -07:00
user target/i386: implement SYSCALL/SYSRET in 32-bit emulators 2023-06-26 10:23:56 +02:00
bpt_helper.c compiler.h: replace QEMU_NORETURN with G_NORETURN 2022-04-21 17:03:51 +04:00
cc_helper_template.h.inc target/i386: Rename helper template headers as '.h.inc' 2023-06-13 11:28:58 +02:00
cc_helper.c target/i386: Rename helper template headers as '.h.inc' 2023-06-13 11:28:58 +02:00
decode-new.c.inc target/i386: validate VEX.W for AVX instructions 2023-10-25 17:35:07 +02:00
decode-new.h target/i386: validate VEX.W for AVX instructions 2023-10-25 17:35:07 +02:00
emit.c.inc target/i386: group common checks in the decoding phase 2023-10-25 17:35:07 +02:00
excp_helper.c target/i386: Raise #GP on unaligned m128 accesses when required. 2022-09-18 09:17:40 +02:00
fpu_helper.c target/translate: Include missing 'exec/cpu_ldst.h' header 2023-08-31 19:47:43 +02:00
helper-tcg.h target/i386: Raise #GP on unaligned m128 accesses when required. 2022-09-18 09:17:40 +02:00
int_helper.c target/i386: Rename helper template headers as '.h.inc' 2023-06-13 11:28:58 +02:00
mem_helper.c target/i386: Inline cmpxchg16b 2023-02-04 06:19:43 -10:00
meson.build
misc_helper.c target/i386: Check for USER_ONLY definition instead of SOFTMMU one 2023-10-07 19:02:33 +02:00
mpx_helper.c
ops_sse_header.h.inc target/i386: implement SHA instructions 2023-10-25 17:35:07 +02:00
seg_helper.c target/i386: fix shadowed variable pasto 2023-10-12 16:37:31 +02:00
seg_helper.h
shift_helper_template.h.inc target/i386: Rename helper template headers as '.h.inc' 2023-06-13 11:28:58 +02:00
tcg-cpu.c target/i386: Fix 32-bit wrapping of pc/eip computation 2023-12-12 13:35:08 -08:00
tcg-cpu.h
tcg-stub.c
translate.c target/i386: Fix 32-bit wrapping of pc/eip computation 2023-12-12 13:35:08 -08:00