More state init; Troubleshooter fixes

This commit is contained in:
Thomas Oltmann 2025-03-15 17:46:14 +01:00
parent 14fa1df99d
commit 4068773b59
3 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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)) {

View file

@ -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);