这篇教程C++ vm_error函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vm_error函数的典型用法代码示例。如果您正苦于以下问题:C++ vm_error函数的具体用法?C++ vm_error怎么用?C++ vm_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vm_error函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: kexe_load_symbool kexe_load_sym(FILE *f, symbol_t *sym) { /* size_t fread_result; */ sym->name = kexe_load_string(f); if (sym->name == NULL) { vm_error("sym->name failed/n"); return (false); } else { vm_debug(DBG_LOADING, "loaded symbol = /"%s/"/n", sym->name); } sym->addr = kexe_load_uint32(f); if (sym->addr == UINT32_MAX) { vm_error("sym->addr failed/n"); return (false); } else { vm_debug(DBG_LOADING, "addr of symbol /"%s/" is " P32 "/n", sym->name, sym->addr); } sym->const_ptr = kexe_load_uint32(f); if (sym->const_ptr == UINT32_MAX) { vm_error("sym->const_ptr failed/n"); return (false); } else { vm_debug(DBG_LOADING, "const ptr of symbol /"%s/" is " P32 "/n", sym->name, sym->const_ptr); } sym->const_flag = sym->const_ptr != 0; /* this could work */ return (true);}
开发者ID:nohajc,项目名称:.KEK-on-Rails,代码行数:32,
示例2: vm_slot_remove_binding/* Remove a slot binding */int vm_slot_remove_binding(vm_instance_t *vm,u_int slot_id,u_int port_id){ struct cisco_card **rc,*sc; u_int i,real_port_id; if (vm_slot_get_info(vm,slot_id,port_id,&rc,&real_port_id) == -1) return(-1); if (*rc == NULL) return(-1); if ((*rc)->drv_info != NULL) { vm_error(vm,"slot %u/%u is still active/n",slot_id,port_id); return(-1); } for(i=0;i<CISCO_CARD_MAX_SUBSLOTS;i++) { if ((sc = (*rc)->sub_slots[i]) != NULL) { vm_error(vm,"sub-slot %u/%u is still active/n", slot_id,sc->subslot_id); return(-1); } } /* Remove all NIOs bindings */ vm_slot_remove_all_nio_bindings(vm,slot_id); /* Free the card info structure */ free(*rc); *rc = NULL; return(0);}
开发者ID:Groundworkstech,项目名称:dynamips-gdb-mod,代码行数:33,
示例3: _vm_setvalue// set valuestatic inline void _vm_setvalue(struct a2_vm* vm_p){ struct a2_obj* _c = callinfo_sfreg(curr_ci, ir_ga(curr_ir)); struct a2_obj* _k = _getvalue(vm_p, ir_gb(curr_ir)); struct a2_obj* _v = _getvalue(vm_p, ir_gc(curr_ir)); struct a2_obj* __d = NULL; switch(obj_t(_c)){ case A2_TARRAY: if(obj_t(_k)!=A2_TNUMBER) vm_error("the key is must number at set array."); __d = a2_array_get(a2_gcobj2array(obj_vX(_c, obj)), _k); if(!__d) goto SVALUE_ERROR; *__d = *_v; break; case A2_TMAP: if(obj_t(_k)!=A2_TNUMBER && obj_t(_k)!=A2_TSTRING) vm_error("the key is must number or string at set map."); __d = a2_map_query(a2_gcobj2map(obj_vX(_c, obj)), _k); if(!__d) goto SVALUE_ERROR; *__d = *_v; break; default: vm_error("the varable is not map or array."); } curr_pc++; return; SVALUE_ERROR: vm_error("the key is overfllow.");}
开发者ID:eagles125,项目名称:A2,代码行数:30,
示例4: c1700_mainboard_set_type/* Set mainboard type */int c1700_mainboard_set_type(c1700_t *router,char *mainboard_type){ struct c1700_mb_id *mb_info; if (router->vm->status == VM_STATUS_RUNNING) { vm_error(router->vm,"unable to change mainboard type when online./n"); return(-1); } if (!(mb_info = c1700_get_mb_info(mainboard_type))) { vm_error(router->vm,"unknown mainboard '%s'/n",mainboard_type); return(-1); } router->mainboard_type = mainboard_type; /* Set the cookie */ memcpy(router->vm->chassis_cookie, eeprom_c1700_mb_data,sizeof(eeprom_c1700_mb_data)); router->vm->chassis_cookie[6] = mb_info->id; /* Set the chassis base MAC address */ c1700_burn_mac_addr(router,&router->mac_addr); /* Set the mainboard driver */ if (vm_slot_active(router->vm,0,0)) vm_slot_remove_binding(router->vm,0,0); vm_slot_add_binding(router->vm,mb_info->mb_driver,0,0); c1700_refresh_systemid(router); return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:35,
示例5: ppc32_vmtest_boot_elf/* Boot the ELF image */static int ppc32_vmtest_boot_elf(vm_instance_t *vm){ m_uint32_t rom_entry_point; cpu_ppc_t *cpu; if (!vm->boot_cpu) return(-1); /* Suspend CPU activity since we will restart directly from ROM */ vm_suspend(vm); /* Check that CPU activity is really suspended */ if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs./n"); return(-1); } /* Reset the boot CPU */ cpu = CPU_PPC32(vm->boot_cpu); ppc32_reset(cpu); /* Load ROM (ELF image or embedded) */ cpu = CPU_PPC32(vm->boot_cpu); rom_entry_point = (m_uint32_t)PPC32_ROM_START; if ((vm->rom_filename != NULL) && (ppc32_load_elf_image(cpu,vm->rom_filename,0,&rom_entry_point) < 0)) { vm_error(vm,"unable to load alternate ROM '%s', " "fallback to embedded ROM./n/n",vm->rom_filename); vm->rom_filename = NULL; } /* Load ELF image */ if (ppc32_load_elf_image(cpu,vm->ios_image, (vm->ghost_status == VM_GHOST_RAM_USE), &vm->ios_entry_point) < 0) { vm_error(vm,"failed to load ELF image '%s'./n",vm->ios_image); return(-1); } /* Launch the simulation */ printf("/nPPC32_VMTEST '%s': starting simulation (CPU0 IA=0x%8.8x), " "JIT %sabled./n", vm->name,cpu->ia,vm->jit_use ? "en":"dis"); vm_log(vm,"PPC32_VMTEST_BOOT", "starting instance (CPU0 IA=0x%8.8x,JIT %s)/n", cpu->ia,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { vm->status = VM_STATUS_RUNNING; cpu_start(vm->boot_cpu); } else { vm->status = VM_STATUS_SHUTDOWN; } return(0);}
开发者ID:Legun,项目名称:dynamips,代码行数:61,
示例6: cisco_card_init/* Initialize a card */static inlineint cisco_card_init(vm_instance_t *vm,struct cisco_card *card,u_int id){ size_t len; /* Check that a device type is defined for this card */ if (!card || !card->dev_type || !card->driver) return(-1); /* Allocate device name */ len = strlen(card->dev_type) + 10; if (!(card->dev_name = malloc(len))) { vm_error(vm,"unable to allocate device name./n"); return(-1); } snprintf(card->dev_name,len,"%s(%u)",card->dev_type,id); /* Initialize card driver */ if (card->driver->card_init(vm,card) == -1) { vm_error(vm,"unable to initialize card type '%s' (id %u)/n", card->dev_type,id); return(-1); } return(0);}
开发者ID:Legun,项目名称:dynamips,代码行数:28,
示例7: c1700_boot_ios/* Boot the IOS image */static int c1700_boot_ios(c1700_t *router){ vm_instance_t *vm = router->vm; cpu_ppc_t *cpu; if (!vm->boot_cpu) return(-1); /* Suspend CPU activity since we will restart directly from ROM */ vm_suspend(vm); /* Check that CPU activity is really suspended */ if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs./n"); return(-1); } /* Reset the boot CPU */ cpu = CPU_PPC32(vm->boot_cpu); ppc32_reset(cpu); /* Adjust stack pointer */ cpu->gpr[1] |= 0x80000000; /* Load BAT registers */ printf("Loading BAT registers/n"); ppc32_load_bat_array(cpu,bat_array); cpu->msr |= PPC32_MSR_IR|PPC32_MSR_DR; /* IRQ routing */ vm->set_irq = c1700_set_irq; vm->clear_irq = c1700_clear_irq; /* Load IOS image */ if (ppc32_load_elf_image(cpu,vm->ios_image, (vm->ghost_status == VM_GHOST_RAM_USE), &vm->ios_entry_point) < 0) { vm_error(vm,"failed to load Cisco IOS image '%s'./n",vm->ios_image); return(-1); } /* Launch the simulation */ printf("/nC1700 '%s': starting simulation (CPU0 IA=0x%8.8x), " "JIT %sabled./n", vm->name,cpu->ia,vm->jit_use ? "en":"dis"); vm_log(vm,"C1700_BOOT", "starting instance (CPU0 PC=0x%8.8x,idle_pc=0x%8.8x,JIT %s)/n", cpu->ia,cpu->idle_pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { vm->status = VM_STATUS_RUNNING; cpu_start(vm->boot_cpu); } else { vm->status = VM_STATUS_SHUTDOWN; } return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:61,
示例8: assertchar *kexe_load_string(FILE *f) { uint32_t len; uint32_t i; char *string; size_t fread_result; assert(sizeof(char) == sizeof(uint8_t)); len = kexe_load_uint32(f); if (len == UINT32_MAX) { vm_error("Failed to read the /"len/" of the string./n"); return (NULL); } else { vm_debug(DBG_LOADING, "Length of the string is " P32 "/n", len); } string = malloc((len + 1) * sizeof(char)); assert(string); fread_result = fread(string, sizeof(char), len, f); if (fread_result != len) { vm_error("Reading of /"string/" has failed. len=" P32 ", fread_result=%zu/n", len, fread_result); return (NULL); } string[len] = '/0'; assert(strlen(string) == (size_t )len); vm_debug(DBG_LOADING, "str=/"%s/", len=%d/n", string, strlen(string)); return (string);}
开发者ID:nohajc,项目名称:.KEK-on-Rails,代码行数:33,
示例9: vtty_tcp_conn_accept/* Accept a TCP connection */static int vtty_tcp_conn_accept(vtty_t *vtty, int nsock){ int fd,*fd_slot; u_int i; if (fd_pool_get_free_slot(&vtty->fd_pool,&fd_slot) < 0) { vm_error(vtty->vm,"unable to create a new VTTY TCP connection/n"); return(-1); } if ((fd = accept(vtty->fd_array[nsock],NULL,NULL)) < 0) { vm_error(vtty->vm,"vtty_tcp_conn_accept: accept on port %d failed %s/n", vtty->tcp_port,strerror(errno)); return(-1); } /* Register the new FD */ *fd_slot = fd; vm_log(vtty->vm,"VTTY","%s is now connected (accept_fd=%d,conn_fd=%d)/n", vtty->name,vtty->fd_array[nsock],fd); /* Adapt Telnet settings */ if (vtty->terminal_support) { vtty_telnet_do_ttype(fd); vtty_telnet_will_echo(fd); vtty_telnet_will_suppress_go_ahead(fd); vtty_telnet_dont_linemode(fd); vtty->input_state = VTTY_INPUT_TEXT; } if (telnet_message_ok == 1) { fd_printf(fd,0, "Connected to Dynamips VM /"%s/" (ID %u, type %s) - %s/r/n" "Press ENTER to get the prompt./r/n", vtty->vm->name, vtty->vm->instance_id, vm_get_type(vtty->vm), vtty->name); /* replay old text */ for (i = vtty->replay_ptr; i < VTTY_BUFFER_SIZE; i++) { if (vtty->replay_buffer[i] != 0) { send(fd,&vtty->replay_buffer[i],VTTY_BUFFER_SIZE-i,0); break; } } for (i = 0; i < vtty->replay_ptr; i++) { if (vtty->replay_buffer[i] != 0) { send(fd,&vtty->replay_buffer[i],vtty->replay_ptr-i,0); break; } } /* warn if not running */ if (vtty->vm->status != VM_STATUS_RUNNING) fd_printf(fd,0,"/r/n!!! WARNING - VM is not running, will be unresponsive (status=%d) !!!/r/n",vtty->vm->status); vtty_flush(vtty); } return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:58,
示例10: c3725_nvram_extract_config/* Directly extract the configuration from the NVRAM device */static ssize_t c3725_nvram_extract_config(vm_instance_t *vm,u_char **buffer){ u_char *base_ptr,*ios_ptr,*cfg_ptr,*end_ptr; m_uint32_t start,nvlen; m_uint16_t magic1,magic2; struct vdevice *nvram_dev; off_t nvram_size; int fd; if ((nvram_dev = dev_get_by_name(vm,"rom"))) dev_sync(nvram_dev); fd = vm_mmap_open_file(vm,"rom",&base_ptr,&nvram_size); if (fd == -1) return(-1); ios_ptr = base_ptr + C3725_NVRAM_OFFSET; end_ptr = base_ptr + nvram_size; if ((ios_ptr + 0x30) >= end_ptr) { vm_error(vm,"NVRAM file too small/n"); return(-1); } magic1 = ntohs(*PTR_ADJUST(m_uint16_t *,ios_ptr,0x06)); magic2 = ntohs(*PTR_ADJUST(m_uint16_t *,ios_ptr,0x08)); if ((magic1 != 0xF0A5) || (magic2 != 0xABCD)) { vm_error(vm,"unable to find IOS magic numbers (0x%x,0x%x)!/n", magic1,magic2); return(-1); } start = ntohl(*PTR_ADJUST(m_uint32_t *,ios_ptr,0x10)) + 1; nvlen = ntohl(*PTR_ADJUST(m_uint32_t *,ios_ptr,0x18)); if (!(*buffer = malloc(nvlen+1))) { vm_error(vm,"unable to allocate config buffer (%u bytes)/n",nvlen); return(-1); } cfg_ptr = ios_ptr + start + 0x08; if ((cfg_ptr + nvlen) > end_ptr) { vm_error(vm,"NVRAM file too small/n"); return(-1); } memcpy(*buffer,cfg_ptr,nvlen-1); (*buffer)[nvlen-1] = 0; return(nvlen-1);}
开发者ID:Groundworkstech,项目名称:dynamips-gdb-mod,代码行数:54,
示例11: kexe_load_methodbool kexe_load_method(FILE *f, method_t **method) { *method = malloc(sizeof(method_t)); assert(*method); (*method)->name = kexe_load_string(f); if ((*method)->name == NULL) { vm_error("loading method.name failed/n"); return (false); } else { vm_debug(DBG_LOADING, "method.name = /"%s/"/n", (*method)->name); } (*method)->args_cnt = kexe_load_uint32(f); if ((*method)->args_cnt == UINT32_MAX) { vm_error("Reading of method.args_cnt has failed./n"); return (false); } else { vm_debug(DBG_LOADING, "method.args_cnt = " P32 "/n", (*method)->args_cnt); } (*method)->locals_cnt = kexe_load_uint32(f); if ((*method)->locals_cnt == UINT32_MAX) { vm_error("Reading of method.locals_cnt has failed./n"); return (false); } else { vm_debug(DBG_LOADING, "method.locals_cnt = " P32 "/n", (*method)->locals_cnt); } (*method)->entry.bc_addr = kexe_load_uint32(f); if ((*method)->entry.bc_addr == UINT32_MAX) { vm_error("Reading of method.entry.bc_addr has failed./n"); return (false); } else { vm_debug(DBG_LOADING, "method.entry.bc_addr = " P32 "/n", (*method)->entry.bc_addr); } (*method)->is_static = kexe_load_uint8(f); if ((*method)->is_static == UINT8_MAX) { vm_error("Reading of methods.is_static has failed./n"); return (false); } else { vm_debug(DBG_LOADING, "method.is_static = " P8 "/n", (*method)->is_static); } (*method)->is_native = false; return (true);}
开发者ID:nohajc,项目名称:.KEK-on-Rails,代码行数:50,
示例12: kexe_load_magicbool kexe_load_magic(FILE *f) { uint32_t kek_magic; kek_magic = kexe_load_uint32(f); if (kek_magic == UINT32_MAX) { vm_error("Failed to load first 32 bits for magic number./n"); return (false); } if (kek_magic != KEK_MAGIC) { vm_error("Loaded magic number is not 0x%08x./n", KEK_MAGIC); return false; } return (true);}
开发者ID:nohajc,项目名称:.KEK-on-Rails,代码行数:15,
示例13: c3725_boot_ios/* Boot the IOS image */static int c3725_boot_ios(c3725_t *router){ vm_instance_t *vm = router->vm; cpu_mips_t *cpu; if (!vm->boot_cpu) return(-1); /* Suspend CPU activity since we will restart directly from ROM */ vm_suspend(vm); /* Check that CPU activity is really suspended */ if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs./n"); return(-1); } /* Reset the boot CPU */ cpu = CPU_MIPS64(vm->boot_cpu); mips64_reset(cpu); /* Load IOS image */ if (mips64_load_elf_image(cpu,vm->ios_image, (vm->ghost_status == VM_GHOST_RAM_USE), &vm->ios_entry_point) < 0) { vm_error(vm,"failed to load Cisco IOS image '%s'./n",vm->ios_image); return(-1); } /* Launch the simulation */ printf("/nC3725 '%s': starting simulation (CPU0 PC=0x%llx), " "JIT %sabled./n", vm->name,cpu->pc,vm->jit_use ? "en":"dis"); vm_log(vm,"C3725_BOOT", "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)/n", cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { vm->status = VM_STATUS_RUNNING; cpu_start(vm->boot_cpu); } else { vm->status = VM_STATUS_SHUTDOWN; } return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:49,
示例14: vm_slot_add_nio_binding/* Add a network IO binding */int vm_slot_add_nio_binding(vm_instance_t *vm,u_int slot_id,u_int port_id, char *nio_name){ struct cisco_nio_binding *nb; struct cisco_card *card,*rc; u_int real_port_id; netio_desc_t *nio; if (!(card = vm_slot_get_card_ptr(vm,slot_id))) return(-1); /* Get the real card (in case this is a sub-slot) */ real_port_id = vm_slot_translate_port_id(vm,slot_id,port_id,&rc); if (rc == NULL) return(-1); /* check that a NIO is not already bound to this port */ if (cisco_card_find_nio_binding(rc,real_port_id) != NULL) { vm_error(vm,"a NIO already exists for interface %u/%u./n", slot_id,port_id); return(-1); } /* acquire a reference on the NIO object */ if (!(nio = netio_acquire(nio_name))) { vm_error(vm,"unable to find NIO '%s'./n",nio_name); return(-1); } /* create a new binding */ if (!(nb = malloc(sizeof(*nb)))) { vm_error(vm,"unable to create NIO binding for interface %u/%u./n", slot_id,port_id); netio_release(nio_name); return(-1); } memset(nb,0,sizeof(*nb)); nb->nio = nio; nb->port_id = real_port_id; nb->orig_port_id = port_id; nb->next = rc->nio_list; if (nb->next) nb->next->prev = nb; rc->nio_list = nb; return(0);}
开发者ID:Groundworkstech,项目名称:dynamips-gdb-mod,代码行数:49,
示例15: vm_slot_cmd_create/* Create a Network Module (command line) */int vm_slot_cmd_create(vm_instance_t *vm,char *str){ char *tokens[SLOT_DESC_MAX_TOKENS]; int i,count,res; u_int slot_id,port_id; /* A port adapter description is like "1:0:NM-1FE" */ count = m_strsplit(str,':',tokens,SLOT_DESC_MAX_TOKENS); if ((count < 2) || (count > 3)) { vm_error(vm,"unable to parse slot description '%s'./n",str); return(-1); } /* Parse the slot id */ slot_id = atoi(tokens[0]); /* Parse the sub-slot id */ if (count == 3) port_id = atoi(tokens[1]); else port_id = 0; /* Add this new slot to the current slot list */ res = vm_slot_add_binding(vm,tokens[count-1],slot_id,port_id); /* The complete array was cleaned by strsplit */ for(i=0;i<SLOT_DESC_MAX_TOKENS;i++) free(tokens[i]); return(res);}
开发者ID:Groundworkstech,项目名称:dynamips-gdb-mod,代码行数:33,
示例16: vm_nvram_extract_config/* Extract IOS configuration from NVRAM and write it to a file */int vm_nvram_extract_config(vm_instance_t *vm,char *filename){ u_char *cfg_buffer = NULL; size_t cfg_len; FILE *fd; if (!vm->platform->nvram_extract_config) return(-1); /* Extract the IOS configuration */ if ((vm->platform->nvram_extract_config(vm,&cfg_buffer,&cfg_len,NULL,NULL)) || (cfg_buffer == NULL)) return(-1); /* Write configuration to the specified filename */ if (!(fd = fopen(filename,"w"))) { vm_error(vm,"unable to create file '%s'/n",filename); free(cfg_buffer); return(-1); } fwrite(cfg_buffer,cfg_len,1,fd); fclose(fd); free(cfg_buffer); return(0);}
开发者ID:ShiningDrops,项目名称:dynamips,代码行数:28,
示例17: c3725_init_gt96100/* Create the two main PCI busses for a GT64120 based system */static int c3725_init_gt96100(c3725_t *router){ vm_instance_t *vm = router->vm; vm_obj_t *obj; vm->pci_bus[0] = pci_bus_create("PCI bus #0",0); vm->pci_bus[1] = pci_bus_create("PCI bus #1",0); if (!vm->pci_bus[0] || !vm->pci_bus[1]) { vm_error(router->vm,"unable to create PCI data./n"); return(-1); } if (dev_gt96100_init(vm,"gt96100",C3725_GT96K_ADDR,0x200000, C3725_GT96K_IRQ, C3725_EXT_IRQ, c3725_net_irq_for_slot_port(0,0), 255) == -1) return(-1); if (!(obj = vm_object_find(router->vm,"gt96100"))) return(-1); router->gt_data = obj->data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:27,
示例18: c3725_burn_mac_addr/* Set the base MAC address of the chassis */static int c3725_burn_mac_addr(c3725_t *router,n_eth_addr_t *addr){ m_uint8_t eeprom_ver; size_t offset; /* Read EEPROM format version */ cisco_eeprom_get_byte(&router->mb_eeprom,0,&eeprom_ver); switch(eeprom_ver) { case 0: cisco_eeprom_set_region(&router->mb_eeprom,2,addr->eth_addr_byte,6); break; case 4: if (!cisco_eeprom_v4_find_field(&router->mb_eeprom,0xC3,&offset)) { cisco_eeprom_set_region(&router->mb_eeprom,offset, addr->eth_addr_byte,6); } break; default: vm_error(router->vm,"c3725_burn_mac_addr: unable to handle " "EEPROM version %u/n",eeprom_ver); return(-1); } return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:29,
示例19: c3725_delete_instance/* Free resources used by a router instance */static int c3725_delete_instance(vm_instance_t *vm){ c3725_t *router = VM_C3725(vm); int i; /* 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(FALSE); } } /* Remove NIO bindings */ for(i=0;i<vm->nr_slots;i++) vm_slot_remove_all_nio_bindings(vm,i); /* Shutdown all Network Modules */ vm_slot_shutdown_all(vm); /* Free mainboard EEPROM */ cisco_eeprom_free(&router->mb_eeprom); /* Free all resources used by VM */ vm_free(vm); /* Free the router structure */ free(router); return(TRUE);}
开发者ID:GNS3,项目名称:dynamips,代码行数:33,
示例20: dev_c7200_pa_ge_init/* * dev_c7200_pa_ge_init() * * Add a PA-GE port adapter into specified slot. */static int dev_c7200_pa_ge_init(vm_instance_t *vm,struct cisco_card *card){ struct pa_i8254x_data *data; u_int slot = card->slot_id; /* Allocate the private data structure for the PA-2FE-TX */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory/n",card->dev_name); return(-1); } /* 2 Ethernet ports */ memset(data,0,sizeof(*data)); data->nr_port = 1; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-GE")); c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom); /* Create the Intel i8254x chip */ data->port[0] = dev_i8254x_init(vm,card->dev_name,0, card->pci_bus,0, c7200_net_irq_for_slot_port(slot,0)); /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:36,
示例21: vtty_put_char/* Put char to vtty */void vtty_put_char(vtty_t *vtty, char ch){ switch(vtty->type) { case VTTY_TYPE_NONE: break; case VTTY_TYPE_TERM: case VTTY_TYPE_SERIAL: if (write(vtty->fd_array[0],&ch,1) != 1) { vm_log(vtty->vm,"VTTY","%s: put char 0x%x failed (%s)/n", vtty->name,(int)ch,strerror(errno)); } break; case VTTY_TYPE_TCP: fd_pool_send(&vtty->fd_pool,&ch,1,0); break; default: vm_error(vtty->vm,"vtty_put_char: bad vtty type %d/n",vtty->type); exit(1); } /* store char for replay */ vtty->replay_buffer[vtty->replay_ptr] = ch; ++vtty->replay_ptr; if (vtty->replay_ptr == VTTY_BUFFER_SIZE) vtty->replay_ptr = 0;}
开发者ID:GNS3,项目名称:dynamips,代码行数:31,
示例22: dev_c7200_iocard_init/* * dev_c7200_iocard_init() * * Add an IOcard into slot 0. */static int dev_c7200_iocard_init(vm_instance_t *vm,struct cisco_card *card){ struct dec21140_data *data; u_int slot = card->slot_id; if (slot != 0) { vm_error(vm,"cannot put IOCARD in PA bay %u!/n",slot); return(-1); } /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,&eeprom_c7200_io_fe); c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom); /* Create the DEC21140 chip */ data = dev_dec21140_init(vm,card->dev_name, card->pci_bus, VM_C7200(vm)->npe_driver->dec21140_pci_dev, c7200_net_irq_for_slot_port(slot,0)); if (!data) return(-1); /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:33,
示例23: switchstatic char *vm_debug_flag(uint32_t flag) { switch (flag) { case DBG_LOADING: return ("loading"); case DBG_BC: return ("bc"); case DBG_STACK: return ("stack"); case DBG_STACK_FULL: return ("stack_full"); case DBG_VM: return ("vm"); case DBG_GC: return ("gc"); case DBG_MEM: return ("mem"); case DBG_OBJ_TBL: return ("obj_tbl"); case DBG_GC_STATS: return ("gc stats"); case DBG_FC: return ("fc"); case DBG_OLD: return ("old"); case DBG_MAS: return ("mas"); default: vm_error("Unknown debug flag=%x/n", flag); return ("unknown"); }}
开发者ID:nohajc,项目名称:.KEK-on-Rails,代码行数:31,
示例24: _vm_foreachloop// foreachloopstatic inline void _vm_foreachloop(struct a2_vm* vm_p){ struct a2_obj* _k = callinfo_sfreg(curr_ci, ir_ga(curr_ir)); struct a2_obj* _v = callinfo_sfreg(curr_ci, ir_ga(curr_ir)+1); struct a2_obj* _c = callinfo_sfreg(curr_ci, ir_ga(curr_ir)+2); struct a2_obj* __v = NULL; if(obj_t(_c)!=A2_TMAP && obj_t(_c)!=A2_TARRAY) vm_error("the varable is not map or array."); // dump next switch(obj_t(_c)){ case A2_TMAP: __v = a2_map_next(a2_gcobj2map(obj_vX(_c, obj)), _k); if(__v==NULL) curr_pc++; else{ *_v = *__v; jump(ir_gbx(curr_ir)); } break; case A2_TARRAY: __v = a2_array_next(a2_gcobj2array(obj_vX(_c, obj)), _k); if(__v==NULL) // dump is end curr_pc++; else{ *_v = *__v; jump(ir_gbx(curr_ir)); } break; default: assert(0); }}
开发者ID:eagles125,项目名称:A2,代码行数:34,
示例25: dev_c7200_pa_8e_init/* * dev_c7200_pa_8e_init() * * Add a PA-8E port adapter into specified slot. */static int dev_c7200_pa_8e_init(vm_instance_t *vm,struct cisco_card *card){ struct pa_4e8e_data *data; u_int slot = card->slot_id; int i; /* Allocate the private data structure for the PA-8E */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory/n",card->dev_name); return(-1); } /* 4 Ethernet ports */ memset(data,0,sizeof(*data)); data->nr_port = 8; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("PA-8E")); c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom); /* Create the AMD Am79c971 chips */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name, AM79C971_TYPE_10BASE_T, card->pci_bus,i, c7200_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:40,
示例26: dev_c2691_nm_eth_init/* * dev_c2691_nm_eth_init() * * Add an Ethernet Network Module into specified slot. */static int dev_c2691_nm_eth_init(vm_instance_t *vm,struct cisco_card *card, int nr_port,int interface_type, const struct cisco_eeprom *eeprom){ struct nm_eth_data *data; u_int slot = card->slot_id; int i; /* Allocate the private data structure */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory./n",card->dev_name); return(-1); } memset(data,0,sizeof(*data)); data->nr_port = nr_port; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,eeprom); c2691_set_slot_eeprom(VM_C2691(vm),slot,&card->eeprom); /* Create the AMD Am971c971 chip(s) */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name,interface_type, card->pci_bus,6+i, c2691_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:Groundworkstech,项目名称:dynamips-gdb-mod,代码行数:40,
示例27: dev_c3600_nm_16esw_init/* Add a NM-16ESW */static int dev_c3600_nm_16esw_init(vm_instance_t *vm,struct cisco_card *card){ struct nm_bay_info *bay_info; struct nm_16esw_data *data; u_int slot = card->slot_id; u_int chassis_id; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,cisco_eeprom_find_nm("NM-16ESW")); dev_nm_16esw_burn_mac_addr(vm,slot,&card->eeprom); c3600_set_slot_eeprom(VM_C3600(vm),slot,&card->eeprom); /* Get PCI bus info about this bay */ chassis_id = c3600_chassis_get_id(VM_C3600(vm)); bay_info = c3600_nm_get_bay_info(chassis_id,slot); if (!bay_info) { vm_error(vm,"unable to get info for NM bay %u/n",slot); return(-1); } /* Create the device */ data = dev_nm_16esw_init(vm,card->dev_name,slot, card->pci_bus,bay_info->pci_device, c3600_net_irq_for_slot_port(slot,0)); /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:34,
示例28: ppc32_vmtest_boot_raw/* Boot the RAW image */_unused static int ppc32_vmtest_boot_raw(vm_instance_t *vm){ cpu_ppc_t *cpu; if (!vm->boot_cpu) return(-1); /* Suspend CPU activity since we will restart directly from ROM */ vm_suspend(vm); /* Check that CPU activity is really suspended */ if (cpu_group_sync_state(vm->cpu_group) == -1) { vm_error(vm,"unable to sync with system CPUs./n"); return(-1); } /* Reset the boot CPU */ cpu = CPU_PPC32(vm->boot_cpu); ppc32_reset(cpu); /* Load RAW image */ if (ppc32_load_raw_image(cpu,vm->ios_image,0xFFF00000) < 0) { vm_error(vm,"failed to load RAW image '%s'./n",vm->ios_image); return(-1); } cpu->ia = 0xFFF00100; cpu->gpr[1] = 0x2000; /* Launch the simulation */ printf("/nPPC32_VMTEST '%s': starting simulation (CPU0 IA=0x%8.8x), " "JIT %sabled./n", vm->name,cpu->ia,vm->jit_use ? "en":"dis"); vm_log(vm,"PPC32_VMTEST_BOOT", "starting instance (CPU0 IA=0x%8.8x,JIT %s)/n", cpu->ia,vm->jit_use ? "on":"off"); /* Start main CPU */ if (vm->ghost_status != VM_GHOST_RAM_GENERATE) { vm->status = VM_STATUS_RUNNING; cpu_start(vm->boot_cpu); } else { vm->status = VM_STATUS_SHUTDOWN; } return(0);}
开发者ID:Legun,项目名称:dynamips,代码行数:48,
示例29: c3725_init_instance/* Initialize a Cisco 3725 instance */static int c3725_init_instance(vm_instance_t *vm){ c3725_t *router = VM_C3725(vm); m_uint32_t rom_entry_point; cpu_mips_t *cpu0; if (!vm->ios_image) { vm_error(vm,"no Cisco IOS image defined."); return(-1); } /* Initialize the C3725 platform */ if (c3725_init_platform(router) == -1) { vm_error(vm,"unable to initialize the platform hardware./n"); return(-1); } /* IRQ routing */ vm->set_irq = c3725_set_irq; vm->clear_irq = c3725_clear_irq; /* Load IOS configuration files */ if (vm->ios_startup_config != NULL || vm->ios_private_config != NULL) { vm_nvram_push_config(vm,vm->ios_startup_config,vm->ios_private_config); vm->conf_reg &= ~0x40; } /* Load ROM (ELF image or embedded) */ cpu0 = CPU_MIPS64(vm->boot_cpu); rom_entry_point = (m_uint32_t)MIPS_ROM_PC; if ((vm->rom_filename != NULL) && (mips64_load_elf_image(cpu0,vm->rom_filename,0,&rom_entry_point) < 0)) { vm_error(vm,"unable to load alternate ROM '%s', " "fallback to embedded ROM./n/n",vm->rom_filename); vm->rom_filename = NULL; } /* Load symbol file */ if (vm->sym_filename) { mips64_sym_load_file(cpu0,vm->sym_filename); cpu0->sym_trace = 1; } return(c3725_boot_ios(router));}
开发者ID:GNS3,项目名称:dynamips,代码行数:48,
示例30: dev_c3600_nm_eth_init/* * dev_c3600_nm_eth_init() * * Add an Ethernet Network Module into specified slot. */static int dev_c3600_nm_eth_init(vm_instance_t *vm,struct cisco_card *card, int nr_port,int interface_type, const struct cisco_eeprom *eeprom){ struct nm_bay_info *bay_info; struct nm_eth_data *data; u_int slot = card->slot_id; u_int chassis_id; int i; /* Allocate the private data structure */ if (!(data = malloc(sizeof(*data)))) { vm_error(vm,"%s: out of memory./n",card->dev_name); return(-1); } memset(data,0,sizeof(*data)); data->nr_port = nr_port; /* Set the PCI bus */ card->pci_bus = vm->slots_pci_bus[slot]; /* Set the EEPROM */ cisco_card_set_eeprom(vm,card,eeprom); c3600_set_slot_eeprom(VM_C3600(vm),slot,&card->eeprom); /* Get PCI bus info about this bay */ chassis_id = c3600_chassis_get_id(VM_C3600(vm)); bay_info = c3600_nm_get_bay_info(chassis_id,slot); if (!bay_info) { vm_error(vm,"unable to get info for NM bay %u/n",slot); return(-1); } /* Create the AMD Am971c971 chip(s) */ for(i=0;i<data->nr_port;i++) { data->port[i] = dev_am79c971_init(vm,card->dev_name,interface_type, card->pci_bus,bay_info->pci_device+i, c3600_net_irq_for_slot_port(slot,i)); } /* Store device info into the router structure */ card->drv_info = data; return(0);}
开发者ID:GNS3,项目名称:dynamips,代码行数:51,
注:本文中的vm_error函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vm_free函数代码示例 C++ vm_deallocate函数代码示例 |