vm_session(x86): support cstar register

Fixes #3964
This commit is contained in:
Alexander Boettcher
2020-11-28 22:05:47 +01:00
committed by Norman Feske
parent 9189342b77
commit c5de2acf57
12 changed files with 37 additions and 14 deletions

View File

@ -152,6 +152,7 @@ struct Vcpu : Thread
MSR_FMASK = 0x2842,
MSR_LSTAR = 0x2844,
MSR_CSTAR = 0x2846,
MSR_STAR = 0x284a,
KERNEL_GS_BASE = 0x284c,
@ -614,6 +615,7 @@ struct Vcpu : Thread
state.star.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_STAR));
state.lstar.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_LSTAR));
state.cstar.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_CSTAR));
state.fmask.value(l4_vm_vmx_read(vmcs, Vmcs::MSR_FMASK));
state.kernel_gs_base.value(l4_vm_vmx_read(vmcs, Vmcs::KERNEL_GS_BASE));
@ -756,7 +758,7 @@ struct Vcpu : Thread
error("pdpte not implemented");
}
if (state.star.valid() || state.lstar.valid() ||
if (state.star.valid() || state.lstar.valid() || state.cstar.valid() ||
state.fmask.valid() || state.kernel_gs_base.valid()) {
error("star, fstar, fmask, kernel_gs_base not implemented");
@ -813,6 +815,9 @@ struct Vcpu : Thread
if (state.lstar.valid())
l4_vm_vmx_write(vmcs, Vmcs::MSR_LSTAR, state.lstar.value());
if (state.cstar.valid())
l4_vm_vmx_write(vmcs, Vmcs::MSR_CSTAR, state.cstar.value());
if (state.fmask.valid())
l4_vm_vmx_write(vmcs, Vmcs::MSR_FMASK, state.fmask.value());
@ -1032,7 +1037,7 @@ struct Vcpu : Thread
vmcb->control_area.tsc_offset = _tsc_offset;
}
if (state.star.value() || state.lstar.value() ||
if (state.star.value() || state.lstar.value() || state.cstar.value() ||
state.fmask.value() || state.kernel_gs_base.value())
error(__LINE__, " not implemented");