/* Free resources used by a VM */ void vm_free(vm_instance_t *vm) { if (vm != NULL) { /* Free hardware resources */ vm_hardware_shutdown(vm); m_log("VM","VM %s destroyed.\n",vm->name); /* Close log file */ vm_close_log(vm); /* Remove the lock file */ vm_release_lock(vm,TRUE); /* Free all chunks */ vm_chunk_free_all(vm); /* Free various elements */ free(vm->rommon_vars.filename); free(vm->ghost_ram_filename); free(vm->sym_filename); free(vm->ios_image); free(vm->ios_startup_config); free(vm->ios_private_config); free(vm->rom_filename); free(vm->name); free(vm); } }
/* Free resources used by a VM */ void vm_free (vm_instance_t * vm) { if (vm != NULL) { /* Free hardware resources */ vm_hardware_shutdown (vm); /* Close log file */ vm_close_log (vm); /* Remove the lock file */ // vm_release_lock(vm,TRUE); /* Free all chunks */ // vm_chunk_free_all(vm); /* Free various elements */ // free(vm->ghost_ram_filename); // free(vm->sym_filename); //free(vm->ios_image); // free(vm->ios_config); //free(vm->rom_filename); free (vm->name); free (vm); } }
/* Stop a test instance */ static int ppc32_vmtest_stop_instance(vm_instance_t *vm) { printf("\nPPC32_VMTEST '%s': stopping simulation.\n",vm->name); vm_log(vm,"PPC32_VMTEST_STOP","stopping simulation.\n"); /* Stop all CPUs */ if (vm->cpu_group != NULL) { vm_stop(vm); if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs.\n"); return(-1); } } /* Free resources that were used during execution to emulate hardware */ vm_hardware_shutdown(vm); return(0); }
/* Stop a Cisco 3725 instance */ static int c3725_stop_instance(vm_instance_t *vm) { printf("\nC3725 '%s': stopping simulation.\n",vm->name); vm_log(vm,"C3725_STOP","stopping simulation.\n"); /* Stop all CPUs */ if (vm->cpu_group != NULL) { vm_stop(vm); if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs.\n"); return(-1); } } /* Free resources that were used during execution to emulate hardware */ vm_slot_shutdown_all(vm); vm_hardware_shutdown(vm); /* Cleanup */ VM_C3725(vm)->iofpga_data = NULL; VM_C3725(vm)->gt_data = NULL; return(0); }