From 48de7efa267a71a0c573a5844603c9c30fe5ca23 Mon Sep 17 00:00:00 2001 From: Jason Chen CJ Date: Thu, 7 Jun 2018 15:04:27 +0800 Subject: [PATCH] instr_emul: remove vm_restart_instruction and use VCPU_RETAIN_RIP there is no need to use wrap function vm_restart_instruction, we can use VCPU_RETAIN_RIP directly Signed-off-by: Jason Chen CJ --- hypervisor/arch/x86/guest/instr_emul.c | 4 ++-- hypervisor/arch/x86/guest/instr_emul_wrapper.c | 9 --------- hypervisor/arch/x86/guest/instr_emul_wrapper.h | 1 - 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/hypervisor/arch/x86/guest/instr_emul.c b/hypervisor/arch/x86/guest/instr_emul.c index d289dda36..f4eed0e01 100644 --- a/hypervisor/arch/x86/guest/instr_emul.c +++ b/hypervisor/arch/x86/guest/instr_emul.c @@ -759,7 +759,7 @@ emulate_movs(struct vcpu *vcpu, __unused uint64_t gpa, struct vie *vie, * Repeat the instruction if the count register is not zero. */ if ((rcx & vie_size2mask(vie->addrsize)) != 0) - vm_restart_instruction(vcpu); + VCPU_RETAIN_RIP(vcpu); } done: ASSERT(error == 0, "%s: unexpected error %d", __func__, error); @@ -823,7 +823,7 @@ emulate_stos(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, * Repeat the instruction if the count register is not zero. */ if ((rcx & vie_size2mask(vie->addrsize)) != 0) - vm_restart_instruction(vcpu); + VCPU_RETAIN_RIP(vcpu); } return 0; diff --git a/hypervisor/arch/x86/guest/instr_emul_wrapper.c b/hypervisor/arch/x86/guest/instr_emul_wrapper.c index 1061017a2..d7d114cca 100644 --- a/hypervisor/arch/x86/guest/instr_emul_wrapper.c +++ b/hypervisor/arch/x86/guest/instr_emul_wrapper.c @@ -115,15 +115,6 @@ int vm_get_seg_desc(struct vcpu *vcpu, int seg, struct seg_desc *desc) return 0; } -int vm_restart_instruction(struct vcpu *vcpu) -{ - if (!vcpu) - return -EINVAL; - - VCPU_RETAIN_RIP(vcpu); - return 0; -} - static bool is_descriptor_table(int reg) { switch (reg) { diff --git a/hypervisor/arch/x86/guest/instr_emul_wrapper.h b/hypervisor/arch/x86/guest/instr_emul_wrapper.h index 371d29822..647a8d8c6 100644 --- a/hypervisor/arch/x86/guest/instr_emul_wrapper.h +++ b/hypervisor/arch/x86/guest/instr_emul_wrapper.h @@ -193,5 +193,4 @@ int vm_get_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *ret_desc); int vm_set_seg_desc(struct vcpu *vcpu, int reg, struct seg_desc *desc); -int vm_restart_instruction(struct vcpu *vcpu); #endif