* [PATCH 1/3] whpx: Fixed reporting of the CPU context to GDB for 64-bit
@ 2022-02-23 5:15 Ivan Shcherbakov
0 siblings, 0 replies; only message in thread
From: Ivan Shcherbakov @ 2022-02-23 5:15 UTC (permalink / raw)
To: qemu-devel; +Cc: armbru, mst
Hi All,
We have been looking into kernel-debugging Linux VMs running on Windows with
Hyper-V enabled (that forces the virtualization software to use WHPX), and
it turned out, none of the major virtualization tools supports it properly.
I've added the missing parts to QEMU and it looks pretty solid: setting
breakpoints in the kernel, running, stepping in/over works reliably and
fast.
The changes involved 3 parts:
1. Fixing the x64 register reporting to gdb (this patch)
2. Fixing synchronization of CR8 <=> APIC.TPR, that was preventing
WHvSetVirtualProcessorRegisters() from working
3. Implementing software breakpoints
It would be great if the changes could be integrated into the QEMU
repository, allowing other Windows users to debug their VMs.
Below is the description of the first patch.
This change makes sure that stopping in the 64-bit mode will set the
HF_CS64_MASK flag in env->hflags (see x86_update_hflags() in
target/i386/cpu.c).
Without it, the code in gdbstub.c would only use the 32-bit register values
when debugging 64-bit targets, making debugging effectively impossible.
Signed-off-by: Ivan Shcherbakov <ivan@sysprogs.com>
---
target/i386/whpx/whpx-all.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index ef896da0a2..edd4fafbdf 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -604,6 +604,8 @@ static void whpx_get_registers(CPUState *cpu)
whpx_apic_get(x86_cpu->apic_state);
}
+ x86_update_hflags(env);
+
return;
}
--
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-02-23 5:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 5:15 [PATCH 1/3] whpx: Fixed reporting of the CPU context to GDB for 64-bit Ivan Shcherbakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).