X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=de6ee041fe4162206f16a1f685f734bb31cc3e5e;hb=0b9cb865c52bc2b6e0a5637d1e1a3cb340ce50f8;hp=14d196348b4673c872765b89f6fb230b8ebfc290;hpb=596d3c2aa2f0a5360baf1c921e4543f014809b78;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index 14d1963..de6ee04 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -269,13 +269,39 @@ int v3_stop_vm(struct v3_vm_info * vm) { vm->run_state = VM_STOPPED; - // force exit all cores via a cross call/IPI - // Wait for all cores to enter CORE_STOPPED state + while (1) { + int i = 0; + int still_running = 0; + + for (i = 0; i < vm->num_cores; i++) { + if (vm->cores[i].core_run_state != CORE_STOPPED) { + still_running = 1; + } + } + + if (still_running == 0) { + break; + } + + V3_Print("Yielding\n"); + + v3_yield(NULL); + } + + V3_Print("VM stopped. Returning\n"); + + return 0; +} + + +int v3_free_vm(struct v3_vm_info * vm) { // deinitialize guest (free memory, etc...) + v3_dev_mgr_deinit(vm); + return 0; }