From b14c32a110000052e5d6aaa911b54dab1e0428b3 Mon Sep 17 00:00:00 2001 From: Jie Deng Date: Tue, 3 Nov 2020 15:31:34 +0800 Subject: [PATCH] hv: Retain RIP only for fault exception. We have trapped the #DB for split-lock emulation. Only fault exception need RIP being retained. Tracked-On: #5605 Signed-off-by: Jie Deng Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/virq.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/guest/virq.c b/hypervisor/arch/x86/guest/virq.c index c5c6f5a99..b5d7860c7 100644 --- a/hypervisor/arch/x86/guest/virq.c +++ b/hypervisor/arch/x86/guest/virq.c @@ -251,8 +251,10 @@ static bool vcpu_inject_exception(struct acrn_vcpu *vcpu) vcpu->arch.exception_info.exception = VECTOR_INVALID; - /* retain rip for exception injection */ - vcpu_retain_rip(vcpu); + /* If this is a fault, we should retain the RIP */ + if (get_exception_type(vector) == EXCEPTION_FAULT) { + vcpu_retain_rip(vcpu); + } /* SDM 17.3.1.1 For any fault-class exception except a debug exception generated in response to an * instruction breakpoint, the value pushed for RF is 1.