X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=078ae4afd634954ae812e00b11ad7b9516fbe79c;hb=7ded4d4eee46a7bccff35de9e4438fd94624547f;hp=abdeeb66afc731397ef09cc17548ab1d8a5aafd3;hpb=a57b321b6e608bf4ff2ae7da11b5cba9d35de35f;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index abdeeb6..078ae4a 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -40,6 +40,7 @@ int v3_dbg_enable = 0; + static void init_cpu(void * arg) { uint32_t cpu_id = (uint32_t)(addr_t)arg; @@ -153,7 +154,8 @@ void Shutdown_V3() { if ((os_hooks) && (os_hooks->call_on_cpu)) { for (i = 0; i < V3_CONFIG_MAX_CPUS; i++) { if (v3_cpu_types[i] != V3_INVALID_CPU) { - deinit_cpu((void *)(addr_t)i); + V3_Call_On_CPU(i, deinit_cpu, (void *)(addr_t)i); + //deinit_cpu((void *)(addr_t)i); } } } @@ -192,6 +194,8 @@ struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name) { } + + static int start_core(void * p) { struct guest_info * core = (struct guest_info *)p; @@ -343,6 +347,33 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { } +int v3_reset_vm_core(struct guest_info * core, addr_t rip) { + + switch (v3_cpu_types[core->pcpu_id]) { +#ifdef V3_CONFIG_SVM + case V3_SVM_CPU: + case V3_SVM_REV3_CPU: + PrintDebug("Resetting SVM Guest CPU %d\n", core->vcpu_id); + return v3_reset_svm_vm_core(core, rip); +#endif +#ifdef V3_CONFIG_VMX + case V3_VMX_CPU: + case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: + PrintDebug("Resetting VMX Guest CPU %d\n", core->vcpu_id); + return v3_reset_vmx_vm_core(core, rip); +#endif + case V3_INVALID_CPU: + default: + PrintError("CPU has no virtualization Extensions\n"); + break; + } + + return -1; +} + + + int v3_stop_vm(struct v3_vm_info * vm) { @@ -374,6 +405,36 @@ int v3_stop_vm(struct v3_vm_info * vm) { } +int v3_pause_vm(struct v3_vm_info * vm) { + + if (vm->run_state != VM_RUNNING) { + PrintError("Tried to pause a VM that was not running\n"); + return -1; + } + + while (v3_raise_barrier(vm, NULL) == -1); + + vm->run_state = VM_PAUSED; + + return 0; +} + + +int v3_continue_vm(struct v3_vm_info * vm) { + + if (vm->run_state != VM_PAUSED) { + PrintError("Tried to continue a VM that was not paused\n"); + return -1; + } + + v3_lower_barrier(vm); + + vm->run_state = VM_RUNNING; + + return 0; +} + + int v3_free_vm(struct v3_vm_info * vm) { int i = 0; // deinitialize guest (free memory, etc...)