/* Map a device at the specified physical address */ int vm_map_device(vm_instance_t *vm,struct vdevice *dev,m_uint64_t base_addr) { #if 0 /* Suspend VM activity */ vm_suspend(vm); if (cpu_group_sync_state(vm->cpu_group) == -1) { fprintf(stderr,"VM%u: unable to sync with system CPUs.\n", vm->instance_id); return(-1); } #endif /* Unbind the device if it was already active */ vm_unbind_device(vm,dev); /* Map the device at the new base address and rebuild MTS */ dev->phys_addr = base_addr; vm_bind_device(vm,dev); cpu_group_rebuild_mts(vm->cpu_group); #if 0 vm_resume(vm); #endif return(0); }
int vm_monitor_resume(void *arg) { struct vmctx *ctx = (struct vmctx *)arg; vm_resume(ctx); return 0; }
/* Resume a VM instance */ static int cmd_resume(hypervisor_conn_t *conn,int argc,char *argv[]) { vm_instance_t *vm; if (!(vm = hypervisor_find_object(conn,argv[0],OBJ_TYPE_VM))) return(-1); vm_resume(vm); vm_release(vm); hypervisor_send_reply(conn,HSC_INFO_OK,1,"VM '%s' resumed",argv[0]); return(0); }
/* Process remote control char */ static void remote_control(vtty_t *vtty,u_char c) { vm_instance_t *vm = vtty->vm; cpu_gen_t *cpu0; cpu0 = vm->boot_cpu; /* Specific commands for the different CPU models */ if (cpu0) { switch(cpu0->type) { case CPU_TYPE_MIPS64: if (remote_control_mips64(vtty,c,CPU_MIPS64(cpu0))) return; break; case CPU_TYPE_PPC32: if (remote_control_ppc32(vtty,c,CPU_PPC32(cpu0))) return; break; } } switch(c) { /* Show the object list */ case 'o': vm_object_dump(vm); break; /* Stop the MIPS VM */ case 'q': vm->status = VM_STATUS_SHUTDOWN; break; /* Reboot the C7200 */ case 'k': #if 0 if (vm->type == VM_TYPE_C7200) c7200_boot_ios(VM_C7200(vm)); #endif break; /* Show the device list */ case 'd': dev_show_list(vm); pci_dev_show_list(vm->pci_bus[0]); pci_dev_show_list(vm->pci_bus[1]); break; /* Show info about Port Adapters or Network Modules */ case 'p': vm_slot_show_all_info(vm); break; /* Dump the MIPS registers */ case 'r': if (cpu0) cpu0->reg_dump(cpu0); break; /* Dump the latest memory accesses */ case 'm': if (cpu0) memlog_dump(cpu0); break; /* Suspend CPU emulation */ case 's': vm_suspend(vm); break; /* Resume CPU emulation */ case 'u': vm_resume(vm); break; /* Dump the MMU information */ case 't': if (cpu0) cpu0->mmu_dump(cpu0); break; /* Dump the MMU information (raw mode) */ case 'z': if (cpu0) cpu0->mmu_raw_dump(cpu0); break; /* Memory translation cache statistics */ case 'l': if (cpu0) cpu0->mts_show_stats(cpu0); break; /* Extract the configuration from the NVRAM */ case 'c': vm_ios_save_config(vm); break; /* Determine an idle pointer counter */ case 'i': if (cpu0) cpu0->get_idling_pc(cpu0); break; /* Experimentations / Tests */ case 'x': #if 0 if (cpu0) { /* IRQ triggering */ vm_set_irq(vm,6); //CPU_MIPS64(cpu0)->irq_disable = TRUE; } #endif #ifdef USE_UNSTABLE tsg_show_stats(); #endif break; case 'y': if (cpu0) { /* IRQ clearing */ vm_clear_irq(vm,6); } break; /* Twice Ctrl + ']' (0x1d, 29), or Alt-Gr + '*' (0xb3, 179) */ case 0x1d: case 0xb3: vtty_store(vtty,c); break; default: printf("\n\nInstance %s (ID %d)\n\n",vm->name,vm->instance_id); printf("o - Show the VM object list\n" "d - Show the device list\n" "r - Dump CPU registers\n" "t - Dump MMU information\n" "z - Dump MMU information (raw mode)\n" "m - Dump the latest memory accesses\n" "s - Suspend CPU emulation\n" "u - Resume CPU emulation\n" "q - Quit the emulator\n" "k - Reboot the virtual machine\n" "b - Show info about JIT compiled pages\n" "l - MTS cache statistics\n" "c - Write IOS configuration to disk\n" "j - Non-JIT mode statistics\n" "i - Determine an idling pointer counter\n" "x - Experimentations (can crash the box!)\n" "^] - Send ^]\n" "Other - This help\n"); } }