54 int disk_id,
int disk_type,
int *n_loadp,
char ***load_namesp)
56 unsigned char buf[0x8000];
57 int res, partnr, n_partitions = 0, n_hfs_partitions = 0;
58 uint64_t hfs_start, hfs_length;
62 fatal(
"apple_load_bootblock: couldn't read the disk " 63 "image. Aborting.\n");
70 int ofs = 0x200 * (partnr + 1);
72 n_partitions = buf[ofs + 7];
73 start = ((uint64_t)buf[ofs + 8] << 24) + (buf[ofs + 9] << 16) +
74 (buf[ofs + 10] << 8) + buf[ofs + 11];
75 length = ((uint64_t)buf[ofs+12] << 24) + (buf[ofs + 13] << 16) +
76 (buf[ofs + 14] << 8) + buf[ofs + 15];
78 debug(
"partition %i: '%s', type '%s', start %i, length %i\n",
79 partnr, buf + ofs + 0x10, buf + ofs + 0x30,
82 if (strcmp((
char *)buf + ofs + 0x30,
"Apple_HFS") == 0) {
84 hfs_start = 512 * start;
85 hfs_length = 512 * length;
90 }
while (partnr < n_partitions);
92 if (n_hfs_partitions == 0) {
93 fatal(
"Error: No HFS partition found! TODO\n");
96 if (n_hfs_partitions >= 2) {
97 fatal(
"Error: Too many HFS partitions found! TODO\n");
void fatal(const char *fmt,...)
int apple_load_bootblock(struct machine *m, struct cpu *cpu, int disk_id, int disk_type, int *n_loadp, char ***load_namesp)
int diskimage_access(struct machine *machine, int id, int type, int writeflag, off_t offset, unsigned char *buf, size_t len)