Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

vcpu: Update EFER state for set/get_regs #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/vcpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down