From eb328d78eae43b7c897d0fa83354a8ddaf8f8d53 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Tue, 16 Oct 2018 09:22:46 +0800 Subject: [PATCH] hv: retain rip if the fault is injected to guest According to SDM 6.5 exception classification, if the fault happens, the CPU will return to the faulting instruction. So we shouldn't change rip to the next instruction if inject fault to guest. Tracked-On: #1473 Signed-off-by: Yin Fengwei Acked-by: Eddie Dong --- hypervisor/arch/x86/virq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hypervisor/arch/x86/virq.c b/hypervisor/arch/x86/virq.c index 0f56f8f68..278b50c2b 100644 --- a/hypervisor/arch/x86/virq.c +++ b/hypervisor/arch/x86/virq.c @@ -261,6 +261,9 @@ static void vcpu_inject_exception(struct vcpu *vcpu, uint32_t vector) (exception_type[vector] << 8U) | (vector & 0xFFU)); vcpu->arch_vcpu.exception_info.exception = VECTOR_INVALID; + + /* retain rip for exception injection */ + vcpu_retain_rip(vcpu); } static int vcpu_inject_hi_exception(struct vcpu *vcpu)