X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fsvm.c;h=3bde027cfe2db48fb3c8733beb457daeb47a14d5;hb=559b7a07d8d5d783f0f2c2a64820ceaeda834a9e;hp=53b410e260193ce82d4145ace1bc2808da358812;hpb=5216daf50c8f0fa5cd7ada595409b9de68f91a4c;p=palacios.releases.git diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 53b410e..3bde027 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -279,22 +279,28 @@ static void Init_VMCB_BIOS(vmcb_t * vmcb, struct guest_info * core) { 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; @@ -304,6 +310,11 @@ int v3_init_svm_vmcb(struct guest_info * info, v3_vm_class_t vm_class) { } +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)); @@ -440,7 +451,6 @@ int v3_svm_enter(struct guest_info * info) { 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 @@ -493,6 +503,7 @@ int v3_svm_enter(struct guest_info * info) { } #endif + v3_update_timers(info); guest_ctrl->TSC_OFFSET = v3_tsc_host_offset(&info->time_state); //V3_Print("Calling v3_svm_launch\n");