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 */ |
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; |
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 |
|
|
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; |
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) { |
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"); |
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 |
|
} |