guest_state->g_pat = 0x7040600070406ULL;
}
+
+ /* tell the guest that we don't support SVM */
+ v3_hook_msr(core->vm_info, SVM_VM_CR_MSR,
+ &v3_handle_vm_cr_read,
+ &v3_handle_vm_cr_write,
+ core);
}
-int v3_init_svm_vmcb(struct guest_info * info, v3_vm_class_t vm_class) {
+int v3_init_svm_vmcb(struct guest_info * core, v3_vm_class_t vm_class) {
PrintDebug("Allocating VMCB\n");
- info->vmm_data = (void*)Allocate_VMCB();
+ core->vmm_data = (void *)Allocate_VMCB();
- if (info->vmm_data == NULL) {
+ if (core->vmm_data == NULL) {
PrintError("Could not allocate VMCB, Exiting...\n");
return -1;
}
if (vm_class == V3_PC_VM) {
- PrintDebug("Initializing VMCB (addr=%p)\n", (void *)info->vmm_data);
- Init_VMCB_BIOS((vmcb_t*)(info->vmm_data), info);
+ PrintDebug("Initializing VMCB (addr=%p)\n", (void *)core->vmm_data);
+ Init_VMCB_BIOS((vmcb_t*)(core->vmm_data), core);
} else {
PrintError("Invalid VM class\n");
return -1;
}
+int v3_deinit_svm_vmcb(struct guest_info * core) {
+ V3_FreePages(V3_PAddr(core->vmm_data), 1);
+ return 0;
+}
+
static int update_irq_exit_state(struct guest_info * info) {
vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data));
vmcb_saved_state_t * guest_state = GET_VMCB_SAVE_STATE_AREA((vmcb_t*)(info->vmm_data));
addr_t exit_code = 0, exit_info1 = 0, exit_info2 = 0;
- v3_update_timers(info);
v3_adjust_time(info);
// Conditionally yield the CPU if the timeslice has expired
}
#endif
+ v3_update_timers(info);
guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state);
//V3_Print("Calling v3_svm_launch\n");