25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $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 $ |
29 |
* |
* |
30 |
* Hammerhead controller, for the secondary CPU on MacPPC machines. |
* COMMENT: Hammerhead controller, for the secondary CPU on MacPPC machines |
31 |
*/ |
*/ |
32 |
|
|
33 |
#include <stdio.h> |
#include <stdio.h> |
53 |
}; |
}; |
54 |
|
|
55 |
|
|
|
/* |
|
|
* dev_hammerhead_access(): |
|
|
*/ |
|
56 |
DEVICE_ACCESS(hammerhead) |
DEVICE_ACCESS(hammerhead) |
57 |
{ |
{ |
|
uint64_t idata = 0, odata=0; |
|
58 |
/* struct hammerhead_data *d = extra; */ |
/* struct hammerhead_data *d = extra; */ |
59 |
|
uint64_t idata = 0, odata=0; |
60 |
|
|
61 |
if (writeflag == MEM_WRITE) |
if (writeflag == MEM_WRITE) |
62 |
idata = memory_readmax64(cpu, data, len); |
idata = memory_readmax64(cpu, data, len); |
73 |
|
|
74 |
other_cpu->running = 1; |
other_cpu->running = 1; |
75 |
other_cpu->pc = idata; |
other_cpu->pc = idata; |
76 |
#ifdef ENABLE_PPC |
|
77 |
if (other_cpu->is_32bit) |
if (other_cpu->is_32bit) |
78 |
ppc32_pc_to_pointers(other_cpu); |
ppc32_pc_to_pointers(other_cpu); |
79 |
else |
else |
80 |
ppc_pc_to_pointers(other_cpu); |
ppc_pc_to_pointers(other_cpu); |
|
#else |
|
|
fatal("Hm. PPC not enabled.\n"); |
|
|
exit(1); |
|
|
#endif |
|
81 |
} else { |
} else { |
82 |
fatal("[ HAMMERHEAD read: TODO ]\n"); |
fatal("[ HAMMERHEAD read: TODO ]\n"); |
83 |
} |
} |
91 |
|
|
92 |
DEVINIT(hammerhead) |
DEVINIT(hammerhead) |
93 |
{ |
{ |
94 |
struct hammerhead_data *d = malloc(sizeof(struct hammerhead_data)); |
struct hammerhead_data *d; |
95 |
|
|
96 |
if (d == NULL) { |
CHECK_ALLOCATION(d = malloc(sizeof(struct hammerhead_data))); |
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
97 |
memset(d, 0, sizeof(struct hammerhead_data)); |
memset(d, 0, sizeof(struct hammerhead_data)); |
98 |
|
|
99 |
memory_device_register(devinit->machine->memory, devinit->name, |
memory_device_register(devinit->machine->memory, devinit->name, |