/[dynamips]/trunk/ppc32_vmtest.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/ppc32_vmtest.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.7/ppc32_vmtest.c revision 10 by dpavlin, Sat Oct 6 16:29:14 2007 UTC upstream/dynamips-0.2.8-RC1/ppc32_vmtest.c revision 11 by dpavlin, Sat Oct 6 16:33:40 2007 UTC
# Line 38  static struct ppc32_bat_prog bat_array[] Line 38  static struct ppc32_bat_prog bat_array[]
38     { -1, -1, 0, 0 },     { -1, -1, 0, 0 },
39  };  };
40    
41  /* Create a new test instance */  /* Create a new router instance */
42  vm_instance_t *ppc32_vmtest_create_instance(char *name,int instance_id)  static int ppc32_vmtest_create_instance(vm_instance_t *vm)
43  {  {
    vm_instance_t *vm;  
   
    if (!(vm = vm_create(name,instance_id,VM_TYPE_PPC32_TEST))) {  
       fprintf(stderr,"PPC32_VMTEST '%s': unable to create VM instance!\n",  
               name);  
       return NULL;  
    }  
   
44     vm->ram_size = PPC32_VMTEST_DEFAULT_RAM_SIZE;     vm->ram_size = PPC32_VMTEST_DEFAULT_RAM_SIZE;
45     return vm;     return(0);
46  }  }
47    
48  /* Free resources used by a test instance */  /* Free resources used by a test instance */
49  static int ppc32_vmtest_free_instance(void *data,void *arg)  static int ppc32_vmtest_delete_instance(vm_instance_t *vm)
50  {  {
51     vm_instance_t *vm = data;     /* Stop all CPUs */
52       if (vm->cpu_group != NULL) {
53     if (vm->type == VM_TYPE_PPC32_TEST) {        vm_stop(vm);
54        /* Stop all CPUs */        
55        if (vm->cpu_group != NULL) {        if (cpu_group_sync_state(vm->cpu_group) == -1) {
56           vm_stop(vm);           vm_error(vm,"unable to sync with system CPUs.\n");
57             return(FALSE);
          if (cpu_group_sync_state(vm->cpu_group) == -1) {  
             vm_error(vm,"unable to sync with system CPUs.\n");  
             return(FALSE);  
          }  
58        }        }
   
       /* Free all resources used by VM */  
       vm_free(vm);  
       return(TRUE);  
59     }     }
60    
61     return(FALSE);     /* Free all resources used by VM */
62  }     vm_free(vm);
63       return(TRUE);
 /* Delete a router instance */  
 int ppc32_vmtest_delete_instance(char *name)  
 {  
    return(registry_delete_if_unused(name,OBJ_TYPE_VM,  
                                     ppc32_vmtest_free_instance,NULL));  
 }  
   
 /* Delete all router instances */  
 int ppc32_vmtest_delete_all_instances(void)  
 {  
    return(registry_delete_type(OBJ_TYPE_VM,ppc32_vmtest_free_instance,NULL));  
64  }  }
65    
66  /* Set IRQ line */  /* Set IRQ line */
# Line 107  static void ppc32_vmtest_clear_irq(vm_in Line 80  static void ppc32_vmtest_clear_irq(vm_in
80  }  }
81    
82  /* Initialize the PPC32 VM test Platform */  /* Initialize the PPC32 VM test Platform */
83  int ppc32_vmtest_init_platform(vm_instance_t *vm)  static int ppc32_vmtest_init_platform(vm_instance_t *vm)
84  {  {
85     cpu_ppc_t *cpu0;     cpu_ppc_t *cpu0;
86     cpu_gen_t *gen0;     cpu_gen_t *gen0;
# Line 183  int ppc32_vmtest_init_platform(vm_instan Line 156  int ppc32_vmtest_init_platform(vm_instan
156  }  }
157    
158  /* Boot the RAW image */  /* Boot the RAW image */
159  int ppc32_vmtest_boot_raw(vm_instance_t *vm)  static int ppc32_vmtest_boot_raw(vm_instance_t *vm)
160  {    {  
161     cpu_ppc_t *cpu;     cpu_ppc_t *cpu;
162    
# Line 232  int ppc32_vmtest_boot_raw(vm_instance_t Line 205  int ppc32_vmtest_boot_raw(vm_instance_t
205  }  }
206    
207  /* Boot the ELF image */  /* Boot the ELF image */
208  int ppc32_vmtest_boot_elf(vm_instance_t *vm)  static int ppc32_vmtest_boot_elf(vm_instance_t *vm)
209  {      {    
210     m_uint32_t rom_entry_point;     m_uint32_t rom_entry_point;
211     cpu_ppc_t *cpu;     cpu_ppc_t *cpu;
# Line 294  int ppc32_vmtest_boot_elf(vm_instance_t Line 267  int ppc32_vmtest_boot_elf(vm_instance_t
267  }  }
268    
269  /* Initialize a test instance */  /* Initialize a test instance */
270  int ppc32_vmtest_init_instance(vm_instance_t *vm)  static int ppc32_vmtest_init_instance(vm_instance_t *vm)
271  {  {
272     /* Initialize the test platform */     /* Initialize the test platform */
273     if (ppc32_vmtest_init_platform(vm) == -1) {     if (ppc32_vmtest_init_platform(vm) == -1) {
# Line 309  int ppc32_vmtest_init_instance(vm_instan Line 282  int ppc32_vmtest_init_instance(vm_instan
282  }  }
283    
284  /* Stop a test instance */  /* Stop a test instance */
285  int ppc32_vmtest_stop_instance(vm_instance_t *vm)  static int ppc32_vmtest_stop_instance(vm_instance_t *vm)
286  {  {
287     printf("\nPPC32_VMTEST '%s': stopping simulation.\n",vm->name);     printf("\nPPC32_VMTEST '%s': stopping simulation.\n",vm->name);
288     vm_log(vm,"PPC32_VMTEST_STOP","stopping simulation.\n");     vm_log(vm,"PPC32_VMTEST_STOP","stopping simulation.\n");
# Line 328  int ppc32_vmtest_stop_instance(vm_instan Line 301  int ppc32_vmtest_stop_instance(vm_instan
301     vm_hardware_shutdown(vm);     vm_hardware_shutdown(vm);
302     return(0);     return(0);
303  }  }
304    
305    /* Platform definition */
306    static vm_platform_t ppc32_vmtest_platform = {
307       "ppc32_test", "PPC32_VMTEST", "PPC32_TEST",
308       ppc32_vmtest_create_instance,
309       ppc32_vmtest_delete_instance,
310       ppc32_vmtest_init_instance,
311       ppc32_vmtest_stop_instance,
312       NULL,
313       NULL,
314       NULL,
315       NULL,
316       NULL,
317       NULL,
318       NULL,
319    };
320    
321    /* Register the ppc32_vmtest platform */
322    int ppc32_vmtest_platform_register(void)
323    {
324       return(vm_platform_register(&ppc32_vmtest_platform));
325    }

Legend:
Removed from v.10  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26