@samitouri / QOSamiQemu / commits / 529e5e7643

target/i386/hvf/x86_mmu: Fix compiler warning

When reusing the code in WHPX, GCC emits the following warning when compiling for i386-softmmu under MSYS2: In file included from ../src/target/i386/emulate/x86_mmu.c:20: ../src/target/i386/emulate/x86_mmu.c: In function 'vmx_write_mem': ../src/target/i386/emulate/x86_mmu.c:251:25: error: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'target_ulong' {aka 'unsigned int'} [-Werror=format=] 251 | VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ | | | target_ulong {aka unsigned int} ../src/target/i386/emulate/panic.h:34:12: note: in definition of macro 'VM_PANIC_EX' 34 | printf(__VA_ARGS__); \ | ^~~~~~~~~~~ ../src/target/i386/emulate/x86_mmu.c:251:48: note: format string is defined here 251 | VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva); | ~~~^ | | | long long unsigned int | %x Fix the warning by reusing the target-specific macro TARGET_FMT_lx which exists for this exact purpose. Fixes: c97d6d2cdf97 ("i386: hvf: add code base from Google's QEMU repository") cc: qemu-stable Signed-off-by: Bernhard Beschow <shentey@gmail.com> Reviewed-by: Mohamed Mediouni <mohamed@unpredictable.fr> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Wei Liu (Microsoft) <wei.liu@kernel.org> Link: https://lore.kernel.org/r/20260223233950.96076-3-mohamed@unpredictable.fr Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Bernhard Beschow committed Feb 24, 2026 at 00:39 UTC 529e5e7643078e19d65e694f51cad64be49090ab
1 file changed +4 -2
target/i386/hvf/x86_mmu.c
+4 -2
@@ -244,7 +244,8 @@ void vmx_write_mem(CPUState *cpu, target_ulong gva, void *data, int bytes)
244 int copy = MIN(bytes, 0x1000 - (gva & 0xfff));
245
246 if (!mmu_gva_to_gpa(cpu, gva, &gpa)) {
247 - VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva);
247 + VM_PANIC_EX("%s: mmu_gva_to_gpa " TARGET_FMT_lx " failed\n",
248 + __func__, gva);
249 } else {
250 address_space_write(&address_space_memory, gpa,
251 MEMTXATTRS_UNSPECIFIED, data, copy);
@@ -265,7 +266,8 @@ void vmx_read_mem(CPUState *cpu, void *data, target_ulong gva, int bytes)
266 int copy = MIN(bytes, 0x1000 - (gva & 0xfff));
267
268 if (!mmu_gva_to_gpa(cpu, gva, &gpa)) {
268 - VM_PANIC_EX("%s: mmu_gva_to_gpa %llx failed\n", __func__, gva);
269 + VM_PANIC_EX("%s: mmu_gva_to_gpa " TARGET_FMT_lx " failed\n",
270 + __func__, gva);
271 }
272 address_space_read(&address_space_memory, gpa, MEMTXATTRS_UNSPECIFIED,
273 data, copy);