From: Jack Lange Date: Fri, 5 Nov 2010 22:43:46 +0000 (-0500) Subject: added run state checks to the vm run loops to allow stopping of VMs X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=53a87a14f98c8f77b252f19d08a7c701b04730ed;p=palacios.git added run state checks to the vm run loops to allow stopping of VMs --- diff --git a/palacios/src/palacios/svm.c b/palacios/src/palacios/svm.c index 4ba619b..a1fad8d 100644 --- a/palacios/src/palacios/svm.c +++ b/palacios/src/palacios/svm.c @@ -586,6 +586,12 @@ int v3_start_svm_guest(struct guest_info * info) { v3_start_time(info); while (1) { + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } + if (v3_svm_enter(info) == -1) { vmcb_ctrl_t * guest_ctrl = GET_VMCB_CTRL_AREA((vmcb_t*)(info->vmm_data)); addr_t host_addr; @@ -622,6 +628,13 @@ int v3_start_svm_guest(struct guest_info * info) { break; } + + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } + /* if ((info->num_exits % 5000) == 0) { diff --git a/palacios/src/palacios/vmx.c b/palacios/src/palacios/vmx.c index 3417767..6ada30f 100644 --- a/palacios/src/palacios/vmx.c +++ b/palacios/src/palacios/vmx.c @@ -778,12 +778,24 @@ int v3_start_vmx_guest(struct guest_info * info) { v3_start_time(info); while (1) { + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } + if (v3_vmx_enter(info) == -1) { v3_print_vmcs(); print_exit_log(info); return -1; } + + + if (info->vm_info->run_state == VM_STOPPED) { + info->core_run_state = CORE_STOPPED; + break; + } /* if ((info->num_exits % 5000) == 0) { V3_Print("VMX Exit number %d\n", (uint32_t)info->num_exits);