mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
add the support for the MSR IA32_FEATURE_CONTROL
- this MSR controlls the usage of VMXON - per dedault HermitCore allows the usage of VMXON outside of SMX
This commit is contained in:
parent
b36e758e9e
commit
82c6dd1e23
2 changed files with 7 additions and 1 deletions
|
@ -195,6 +195,7 @@ extern "C" {
|
|||
#define MSR_KERNEL_GS_BASE 0xc0000102
|
||||
|
||||
#define MSR_IA32_MISC_ENABLE 0x000001a0
|
||||
#define MSR_IA32_FEATURE_CONTROL 0x0000003a
|
||||
|
||||
// MSR EFER bits
|
||||
#define EFER_SCE (1 << 0)
|
||||
|
|
|
@ -318,6 +318,9 @@ int cpu_detection(void) {
|
|||
if (has_nx())
|
||||
wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_NXE);
|
||||
|
||||
if (has_vmx())
|
||||
wrmsr(MSR_IA32_FEATURE_CONTROL, rdmsr(MSR_IA32_FEATURE_CONTROL) | 0x5);
|
||||
|
||||
writefs(0);
|
||||
#if MAX_CORES > 1
|
||||
writegs(atomic_int32_read(¤t_boot_id) * ((size_t) &percore_end0 - (size_t) &percore_start));
|
||||
|
@ -417,8 +420,10 @@ int cpu_detection(void) {
|
|||
if (first_time) {
|
||||
kprintf("CR0 0x%llx, CR4 0x%llx\n", read_cr0(), read_cr4());
|
||||
kprintf("size of xsave_t: %d\n", sizeof(xsave_t));
|
||||
if (has_msr())
|
||||
if (has_msr()) {
|
||||
kprintf("IA32_MISC_ENABLE 0x%llx\n", rdmsr(MSR_IA32_MISC_ENABLE));
|
||||
kprintf("IA32_FEATURE_CONTROL 0x%llx\n", rdmsr(MSR_IA32_FEATURE_CONTROL));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue