qemu/target/i386
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
..
hvf target/i386/hvf: Rename 'X86CPU *x86_cpu' variable as 'cpu' 2023-11-07 12:13:27 +01:00
kvm i386/sev: Avoid SEV-ES crash due to missing MSR_EFER_LMA bit 2023-12-06 14:34:11 -05:00
nvmm migration: simplify blockers 2023-10-20 08:51:41 +02:00
tcg target/i386: Fix 32-bit wrapping of pc/eip computation 2023-12-12 13:35:08 -08:00
whpx migration: simplify blockers 2023-10-20 08:51:41 +02:00
arch_dump.c
arch_memory_mapping.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
cpu-dump.c
cpu-internal.h
cpu-param.h
cpu-qom.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
cpu-sysemu.c target/i386/cpu-sysemu: Inline kvm_apic_in_kernel() 2023-09-07 13:32:37 +02:00
cpu.c target/i386/cpu: Improve error message for property "vendor" 2023-11-17 10:07:52 +01:00
cpu.h target/i386: Fix 32-bit wrapping of pc/eip computation 2023-12-12 13:35:08 -08:00
gdbstub.c
helper.c target/i386/helper: Restrict KVM declarations to system emulation 2023-09-07 13:32:37 +02:00
helper.h target/i386: implement SYSCALL/SYSRET in 32-bit emulators 2023-06-26 10:23:56 +02:00
host-cpu.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
host-cpu.h
Kconfig
machine.c i386: spelling fixes 2023-09-20 07:54:34 +03:00
meson.build meson: Rename target_softmmu_arch -> target_system_arch 2023-10-07 19:03:07 +02:00
monitor.c target/i386/monitor: synchronize cpu state for lapic info 2023-11-07 12:13:27 +01:00
ops_sse.h target/i386: implement SHA instructions 2023-10-25 17:35:07 +02:00
sev-sysemu-stub.c
sev.c migration: simplify blockers 2023-10-20 08:51:41 +02:00
sev.h bulk: Do not declare function prototypes using 'extern' keyword 2023-08-31 19:47:43 +02:00
svm.h target/i386: check intercept for XSETBV 2023-10-17 15:20:53 +02:00
trace-events
trace.h
xsave_helper.c