--- trunk/src/devices/dev_hammerhead.c 2007/10/08 16:21:17 34 +++ trunk/src/devices/dev_hammerhead.c 2007/10/08 16:22:32 42 @@ -25,9 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_hammerhead.c,v 1.4 2006/12/30 13:30:58 debug Exp $ + * $Id: dev_hammerhead.c,v 1.6 2007/06/15 19:11:15 debug Exp $ * - * Hammerhead controller, for the secondary CPU on MacPPC machines. + * COMMENT: Hammerhead controller, for the secondary CPU on MacPPC machines */ #include @@ -53,13 +53,10 @@ }; -/* - * dev_hammerhead_access(): - */ DEVICE_ACCESS(hammerhead) { - uint64_t idata = 0, odata=0; /* struct hammerhead_data *d = extra; */ + uint64_t idata = 0, odata=0; if (writeflag == MEM_WRITE) idata = memory_readmax64(cpu, data, len); @@ -76,15 +73,11 @@ other_cpu->running = 1; other_cpu->pc = idata; -#ifdef ENABLE_PPC + if (other_cpu->is_32bit) ppc32_pc_to_pointers(other_cpu); else ppc_pc_to_pointers(other_cpu); -#else - fatal("Hm. PPC not enabled.\n"); - exit(1); -#endif } else { fatal("[ HAMMERHEAD read: TODO ]\n"); } @@ -98,12 +91,9 @@ DEVINIT(hammerhead) { - struct hammerhead_data *d = malloc(sizeof(struct hammerhead_data)); + struct hammerhead_data *d; - if (d == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + CHECK_ALLOCATION(d = malloc(sizeof(struct hammerhead_data))); memset(d, 0, sizeof(struct hammerhead_data)); memory_device_register(devinit->machine->memory, devinit->name,