From dca031c05ce18d5423908613106dedd84f6f8e23 Mon Sep 17 00:00:00 2001 From: Hang Yuan Date: Wed, 25 Sep 2019 01:49:13 +0800 Subject: [PATCH] Add VM pause support Check if Qemu wants to pause VM. If yes, don't enter guest. This is used in snapshot scenario that Qemu pauses VM and tell HAXM not to enter guest after it finishes the last guest IO/MMIO instruction. Signed-off-by: Hang Yuan --- core/vcpu.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/vcpu.c b/core/vcpu.c index 9a505568..105b8e50 100644 --- a/core/vcpu.c +++ b/core/vcpu.c @@ -1711,6 +1711,14 @@ int vcpu_execute(struct vcpu_t *vcpu) goto out; } } + + // Check if Qemu pauses VM + if (htun->_exit_reason == HAX_EXIT_PAUSED) { + htun->_exit_status = HAX_EXIT_PAUSED; + hax_log(HAX_LOGD, "vcpu paused\n"); + goto out; + } + err = cpu_vmx_execute(vcpu, htun); vcpu_is_panic(vcpu); out: