diff --git a/include/x86/vmx.h b/include/x86/vmx.h index b6c1614..a54219e 100644 --- a/include/x86/vmx.h +++ b/include/x86/vmx.h @@ -33,6 +33,7 @@ #define EXCEPTION_BITMAP 0x4004 #define CR3_TARGET_COUNT 0x400A #define VM_EXIT_CONTROLS 0x400C +#define VM_EXIT_MSR_STORE_COUNT 0x400E #define VM_ENTRY_CONTROLS 0x4012 #define VM_ENTRY_MSR_LOAD_COUNT 0x4014 #define VM_ENTRY_INTR_INFO_FIELD 0x4016 diff --git a/src/efi.c b/src/efi.c index 5a968d3..043cba8 100644 --- a/src/efi.c +++ b/src/efi.c @@ -100,6 +100,7 @@ ts_repl(void) ts_skipws(&cur); if (!ts_parsehex(&cur, &index)) goto huh; if (*cur) { + ts_skipws(&cur); if (!ts_parsehex(&cur, &value)) goto huh; writemsr64(index, value); } else { @@ -113,6 +114,7 @@ ts_repl(void) ts_skipws(&cur); if (!ts_parsehex(&cur, &index)) goto huh; if (*cur) { + ts_skipws(&cur); if (!ts_parsehex(&cur, &value)) goto huh; checked_vmwrite(index, value); } else { @@ -123,6 +125,8 @@ ts_repl(void) break; case 'l': + ts_skipws(&cur); + if (*cur) goto huh; AsciiPrint("VMLAUNCH\n"); status = vmlaunch(); if (status & (1 << 0)) { diff --git a/src/vintel.c b/src/vintel.c index acaa8a0..30127aa 100644 --- a/src/vintel.c +++ b/src/vintel.c @@ -207,6 +207,10 @@ vintel_init_host(void) // Set GDT and IDT checked_vmwrite(HOST_GDTR_BASE, (uintptr_t)pv->host_gdtr.base); checked_vmwrite(HOST_IDTR_BASE, (uintptr_t)pv->host_idtr.base); + + // Dummy sysenter & sysexit values + checked_vmwrite(HOST_SYSENTER_ESP, 0x4000); + checked_vmwrite(HOST_SYSENTER_EIP, 0x4000); } void @@ -273,6 +277,7 @@ vintel_enable(void) checked_vmwrite(VM_ENTRY_MSR_LOAD_COUNT, 0); checked_vmwrite(VM_ENTRY_INTR_INFO_FIELD, 0); + checked_vmwrite(VM_EXIT_MSR_STORE_COUNT, 0); checked_vmwrite(CR3_TARGET_COUNT, 0); checked_vmwrite(EXCEPTION_BITMAP, 0);