qemu/target/i386
Alexander Graf 8fa11a4df3 target/i386: Fix legacy page table walk
Commit b56617bbcb ("target/i386: Walk NPT in guest real mode") added
logic to run the page table walker even in real mode if we are in NPT
mode.  That function then determined whether real mode or paging is
active based on whether the pg_mode variable was 0.

Unfortunately pg_mode is 0 in two situations:

  1) Paging is disabled (real mode)
  2) Paging is in 2-level paging mode (32bit without PAE)

That means the walker now assumed that 2-level paging mode was real
mode, breaking NetBSD as well as Windows XP.

To fix that, this patch adds a new PG flag to pg_mode which indicates
whether paging is active at all and uses that to determine whether we
are in real mode or not.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2654
Fixes: b56617bbcb ("target/i386: Walk NPT in guest real mode")
Signed-off-by: Alexander Graf <graf@amazon.com>
Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Link: https://lore.kernel.org/r/20241106154329.67218-1-graf@amazon.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-11-07 16:54:02 +01:00
..
hvf target/i386/hvf: fix clang compilation warning 2024-11-07 16:54:02 +01:00
kvm target/i386: add AVX10 feature and AVX10 version property 2024-10-31 18:28:33 +01:00
nvmm cpu: move Qemu[Thread|Cond] setup into common code 2024-06-04 10:02:39 +02:00
tcg target/i386: Fix legacy page table walk 2024-11-07 16:54:02 +01:00
whpx cpu: move Qemu[Thread|Cond] setup into common code 2024-06-04 10:02:39 +02:00
arch_dump.c dump: Replace opaque DumpState pointer with a typed one 2022-10-06 19:30:43 +04:00
arch_memory_mapping.c memory: follow Error API guidelines 2023-10-19 23:13:27 +02:00
confidential-guest.c target/i386: introduce x86-confidential-guest 2024-04-23 17:35:25 +02:00
confidential-guest.h target/i386: add support for masking CPUID features in confidential guests 2024-07-04 07:47:11 +02:00
cpu-apic.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
cpu-dump.c target/i386: remove CC_OP_CLR 2024-10-31 18:28:33 +01:00
cpu-internal.h
cpu-param.h license: Update deprecated SPDX tag LGPL-2.0+ to LGPL-2.0-or-later 2024-09-20 10:11:59 +03:00
cpu-qom.h target: Move ArchCPUClass definition to 'cpu.h' 2023-11-07 13:08:48 +01:00
cpu-sysemu.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
cpu.c target/i386: add sha512, sm3, sm4 feature bits 2024-11-07 16:54:01 +01:00
cpu.h target/i386: Fix legacy page table walk 2024-11-07 16:54:02 +01:00
gdbstub.c target/i386/gdbstub: Expose orig_ax 2024-10-13 10:05:51 -07:00
helper.c i386: Fix MCE support for AMD hosts 2024-06-08 10:33:38 +02:00
helper.h target/i386: optimize computation of ZF from CC_OP_DYNAMIC 2024-10-31 18:28:33 +01:00
host-cpu.c i386/cpu: Drop the check of phys_bits in host_cpu_realizefn() 2024-10-31 18:28:32 +01:00
host-cpu.h
Kconfig i386: select correct components for no-board build 2024-05-10 15:45:15 +02:00
machine.c target/i386: Add support save/load HWCR MSR 2024-10-17 12:30:21 +02:00
meson.build target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
monitor.c target/i386: Move APIC related code to cpu-apic.c 2024-04-25 10:12:54 +02:00
ops_sse.h target/i386: set CC_OP in helpers if they want CC_OP_EFLAGS 2024-05-25 13:28:01 +02:00
sev-sysemu-stub.c hw/i386/sev: Add support to encrypt BIOS when SEV-SNP is enabled 2024-06-05 11:01:06 +02:00
sev.c qapi/crypto: Rename QCryptoHashAlgorithm to *Algo, and drop prefix 2024-09-10 14:02:16 +02:00
sev.h hw/i386/sev: Add support to encrypt BIOS when SEV-SNP is enabled 2024-06-05 11:01:06 +02:00
svm.h target/i386: check intercept for XSETBV 2023-10-17 15:20:53 +02:00
trace-events target/i386/sev: Use size_t for object sizes 2024-06-28 19:26:54 +02:00
trace.h
xsave_helper.c