switch (msr) {
case MCG_CAP:
- PrintDebug(MSG_PRE "Ignoring write to MCG_CAP MSR.\n");
+ PrintDebug(core->vm_info, core, MSG_PRE "Ignoring write to MCG_CAP MSR.\n");
break;
case MCG_STAT:
case MCG_CTRL:
if (!state->mcg_cap.mcg_ctl_p) {
- PrintDebug(MSG_PRE "Ignoring write to control MSR '0x%x'. Control MSRs not supported.\n", msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Ignoring write to control MSR '0x%x'. Control MSRs not supported.\n", msr);
break;
}
break;
default:
- PrintError(MSG_PRE "Reading from invalid MSR: %x\n", msr);
+ PrintError(core->vm_info, core, MSG_PRE "Reading from invalid MSR: %x\n", msr);
return -1;
}
case MCG_CTRL:
if (!state->mcg_cap.mcg_ctl_p) {
- PrintDebug(MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
break;
}
break;
default:
- PrintError(MSG_PRE "Reading from invalid MSR: %x\n", msr);
+ PrintError(core->vm_info, core, MSG_PRE "Reading from invalid MSR: %x\n", msr);
return -1;
}
struct mcheck_state * const state = (struct mcheck_state *)priv_data;
struct mci_bank * mci = get_mci_reg(state, msr);
- PrintDebug(MSG_PRE "Reading value '0x%llx' for MSR '0x%x'.\n", dst->value, msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Reading value '0x%llx' for MSR '0x%x'.\n", dst->value, msr);
if (mci == NULL) {
- PrintError(MSG_PRE " MSR read for invalid MCI register 0x%x\n", msr);
+ PrintError(core->vm_info, core, MSG_PRE " MSR read for invalid MCI register 0x%x\n", msr);
return -1;
}
switch (msr & ~MCi_MASK) {
case MCi_CTRL:
if (!state->mcg_cap.mcg_ctl_p) {
- PrintDebug(MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
break;
}
break;
default:
- PrintError(MSG_PRE "Ignoring read of unhooked MSR '0x%x'. This is a bug.\n", msr);
+ PrintError(core->vm_info, core, MSG_PRE "Ignoring read of unhooked MSR '0x%x'. This is a bug.\n", msr);
break;
}
struct mcheck_state * const state = (struct mcheck_state *)priv_data;
struct mci_bank * mci = get_mci_reg(state, msr);
- PrintDebug(MSG_PRE "Writing value '0x%llx' for MSR '0x%x'.\n", src.value, msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Writing value '0x%llx' for MSR '0x%x'.\n", src.value, msr);
switch (msr & ~MCi_MASK) {
case MCi_CTRL:
if (!state->mcg_cap.mcg_ctl_p) {
- PrintDebug(MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
+ PrintDebug(core->vm_info, core, MSG_PRE "Ignoring read of control MSR '0x%x'. Control MSRs not supported.\n", msr);
break;
}
case MCi_STAT:
if (src.value != 0) {
// Should be a GPF.
- PrintError(MSG_PRE "Ignoring write of illegal value '0x%llx'.\n", src.value);
+ PrintError(core->vm_info, core, MSG_PRE "Ignoring write of illegal value '0x%llx'.\n", src.value);
return -1;
}
break;
case MCi_MISC:
- V3_Print(MSG_PRE "Ignoring write to read only miscellaneous MSR '0x%x'.\n", msr);
+ V3_Print(core->vm_info, core, MSG_PRE "Ignoring write to read only miscellaneous MSR '0x%x'.\n", msr);
break;
default:
- PrintError(MSG_PRE "Ignoring write of unhooked MSR '0x%x'. This is a bug.\n", msr);
+ PrintError(core->vm_info, core, MSG_PRE "Ignoring write of unhooked MSR '0x%x'. This is a bug.\n", msr);
break;
}
CPUID_FIELDS, CPUID_FIELDS);
if (ret == -1) {
- PrintError(MSG_PRE "Failed to add CPUID fields for function 0000_0001.\n");
- return -1;
+ PrintError(vm, VCORE_NONE, MSG_PRE "Failed to add CPUID fields for function 0000_0001.\n");
+ return -1;
}
// Add bit 7, MCE availability, and bit 14, MCE availability.
CPUID_FIELDS, CPUID_FIELDS);
if (ret == -1) {
- PrintError(MSG_PRE "Failed to add CPUID fileds for function 8000_0001.\n");
+ PrintError(vm, VCORE_NONE, MSG_PRE "Failed to add CPUID fileds for function 8000_0001.\n");
return -1;
}
static int deinit_mcheck(struct v3_vm_info * vm, void * priv_data) {
struct mcheck_state * state = (struct mcheck_state *)v3_get_extension_state(vm, priv_data);
if (state == NULL) {
- PrintError(MSG_PRE "Failed to get machine-check architecture extension state.\n");
+ PrintError(vm, VCORE_NONE, MSG_PRE "Failed to get machine-check architecture extension state.\n");
return -1;
}
state = (struct mcheck_state *)V3_Malloc(sizeof(struct mcheck_state));
if (state == NULL) {
- PrintError(MSG_PRE "Failed to allocate machine-check architecture state.\n");
- return -1;
+ PrintError(vm, VCORE_NONE, MSG_PRE "Failed to allocate machine-check architecture state.\n");
+ return -1;
}
}
if (ret == -1) {
- PrintError(MSG_PRE "Error hooking machine-check architecture resources.\n");
+ PrintError(vm, VCORE_NONE, MSG_PRE "Error hooking machine-check architecture resources.\n");
V3_Free(state);
return -1;
}
*priv_data = state;
- PrintDebug(MSG_PRE "Initialized machine-check architecture.\n");
+ PrintDebug(vm, VCORE_NONE, MSG_PRE "Initialized machine-check architecture.\n");
return 0;
}
int ret;
if (state == NULL) {
- PrintError(MSG_PRE "Machine-check architecture extension state not found.\n");
+ PrintError(vm, VCORE_NONE, MSG_PRE "Machine-check architecture extension state not found.\n");
return -1;
}
// For now only MCE injection on cpu 0 is supported.
if (cpu != 0) {
- PrintError(MSG_PRE "Injecting MCE on cpu %u not supported.\n", cpu);
+ PrintError(vm, VCORE_NONE, MSG_PRE "Injecting MCE on cpu %u not supported.\n", cpu);
return -1;
}
// Is the Northbridge bank enabled?
if (state->mcg_ctl.nbe != 1) {
- PrintDebug(MSG_PRE "Northbridge register bank disabled. Ignoring Northbridge MCE.\n");
+ PrintDebug(vm, VCORE_NONE, MSG_PRE "Northbridge register bank disabled. Ignoring Northbridge MCE.\n");
return 0;
}
state->mcg_stat.ripv = 1;
state->mcg_stat.mcip = 1;
- PrintDebug(MSG_PRE "Injecting NB MCE on core %u.\n", 0);
+ PrintDebug(vm, VCORE_NONE, MSG_PRE "Injecting NB MCE on core %u.\n", 0);
// Raise on core 0.
ret = v3_raise_exception(&(vm->cores[0]), MCE_INTERRUPT);
if (ret == -1) {
- PrintError(MSG_PRE "Failed to raise MCE.\n");
+ PrintError(vm, VCORE_NONE, MSG_PRE "Failed to raise MCE.\n");
return -1;
}
static struct v3_extension_impl mcheck_impl = {
.name = MCHECK,
- .init = init_mcheck,
- .deinit = deinit_mcheck,
+ .init = NULL,
+ .vm_init = init_mcheck,
+ .vm_deinit = deinit_mcheck,
.core_init = NULL,
.core_deinit = NULL,
.on_entry = NULL,