From f2c29cf3444551b44f3bf2f7a0f6025937800076 Mon Sep 17 00:00:00 2001 From: Nick Renieris Date: Thu, 20 Jun 2019 04:34:00 +0300 Subject: [PATCH] vcpu: Update EFER state for set/get_regs Co-authored-by: Jake Arveson Signed-off-by: Nick Renieris --- core/vcpu.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/vcpu.c b/core/vcpu.c index 56e0e83d..41ec131f 100644 --- a/core/vcpu.c +++ b/core/vcpu.c @@ -3878,6 +3878,9 @@ int vcpu_get_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate) ustate->_dr3 = state->_dr3; ustate->_dr6 = state->_dr6; ustate->_dr7 = state->_dr7; + + ustate->_efer = state->_efer; + _copy_desc(&state->_cs, &ustate->_cs); _copy_desc(&state->_ds, &ustate->_ds); _copy_desc(&state->_es, &ustate->_es); @@ -3907,7 +3910,7 @@ int vcpu_set_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate) { struct vcpu_state_t *state = vcpu->state; int i; - int cr_dirty = 0, dr_dirty = 0; + int cr_dirty = 0, dr_dirty = 0, efer_dirty = 0; preempt_flag flags; int rsp_dirty = 0; uint32_t vmcs_err = 0; @@ -3948,6 +3951,11 @@ int vcpu_set_regs(struct vcpu_t *vcpu, struct vcpu_state_t *ustate) vmwrite_cr(vcpu); } + UPDATE_VCPU_STATE(_efer, efer_dirty); + if (efer_dirty) { + vmwrite_efer(vcpu); + } + /* * When the guest debug feature is in use (HAX_DEBUG_ENABLE is on), guest * DR state is owned by the debugger (QEMU gdbserver), and must be