diff -arcN libdisk.orig/Makefile libdisk/Makefile *** libdisk.orig/Makefile Wed Mar 29 15:41:00 2000 --- libdisk/Makefile Wed Mar 29 15:41:30 2000 *************** *** 6,11 **** --- 6,14 ---- INCS= libdisk.h CFLAGS+= -Wall + .if ${MACHINE} == "pc98" + CFLAGS+= -DPC98 + .endif CLEANFILES+= tmp.c tst01 tst01.o VPATH= ${.CURDIR}/../../sbin/disklabel NOPROFILE= yes diff -arcN libdisk.orig/change.c libdisk/change.c *** libdisk.orig/change.c Wed Mar 29 15:41:00 2000 --- libdisk/change.c Wed Mar 29 15:41:30 2000 *************** *** 25,33 **** --- 25,36 ---- disk->bios_cyl = cyl; disk->bios_hd = hd; disk->bios_sect = sect; + #ifndef PC98 Bios_Limit_Chunk(disk->chunks,1024*hd*sect); + #endif } + /* XXX - parameters should change to fit for PC-98, but I'm not sure */ void Sanitize_Bios_Geom(struct disk *disk) { *************** *** 74,82 **** --- 77,94 ---- c=d->chunks; if (force_all) { Sanitize_Bios_Geom(d); + #ifdef PC98 + Create_Chunk(d,c->offset,c->size,freebsd,0x494, + CHUNK_FORCE_ALL,"FreeBSD"); + #else Create_Chunk(d,c->offset,c->size,freebsd,0xa5, CHUNK_FORCE_ALL); + #endif } else { + #ifdef PC98 + Create_Chunk(d,c->offset,c->size,freebsd,0x494, 0,"FreeBSD"); + #else Create_Chunk(d,c->offset,c->size,freebsd,0xa5, 0); + #endif } } diff -arcN libdisk.orig/chunk.c libdisk/chunk.c *** libdisk.orig/chunk.c Wed Mar 29 15:41:00 2000 --- libdisk/chunk.c Wed Mar 29 15:41:30 2000 *************** *** 44,49 **** --- 44,50 ---- case whole: if (Chunk_Inside(chunks,&ct)) return chunks; + #ifndef PC98 case extended: for(c1=chunks->part;c1;c1=c1->next) { if (c1->type != type) *************** *** 52,57 **** --- 53,59 ---- return c1; } return 0; + #endif case freebsd: for(c1=chunks->part;c1;c1=c1->next) { if (c1->type == type) *************** *** 82,87 **** --- 84,92 ---- if(c1->next) Free_Chunk(c1->next); free(c1->name); + #ifdef PC98 + free(c1->sname); + #endif free(c1); } *************** *** 97,110 **** --- 102,123 ---- if (c1->private_data && c1->private_clone) c2->private_data = c2->private_clone(c2->private_data); c2->name = strdup(c2->name); + #ifdef PC98 + c2->sname = strdup(c2->sname); + #endif c2->next = Clone_Chunk(c2->next); c2->part = Clone_Chunk(c2->part); return c2; } int + #ifdef PC98 + Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, + chunk_e type, int subtype, u_long flags, const char *sname) + #else Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, chunk_e type, int subtype, u_long flags) + #endif { struct chunk *ct,*cs; *************** *** 120,125 **** --- 133,141 ---- ct->size = size; ct->end = offset + size - 1; ct->type = type; + #ifdef PC98 + ct->sname = strdup(sname); + #endif ct->name = strdup(name); ct->subtype = subtype; ct->flags = flags; *************** *** 138,143 **** --- 154,162 ---- cs->size = size; cs->end = offset + size - 1; cs->type = unused; + #ifdef PC98 + cs->sname = strdup(sname); + #endif cs->name = strdup("-"); ct->part = cs; } *************** *** 150,155 **** --- 169,178 ---- cs->disk = c2->disk; cs->offset = ct->end + 1; cs->size = c2->end - ct->end; + #ifdef PC98 + if(c2->sname) + cs->sname = strdup(c2->sname); + #endif if(c2->name) cs->name = strdup(c2->name); c2->next = cs; *************** *** 158,168 **** --- 181,197 ---- } /* If no leading unused space just occupy the old chunk */ if (c2->offset == ct->offset) { + #ifdef PC98 + c2->sname = ct->sname; + #endif c2->name = ct->name; c2->type = ct->type; c2->part = ct->part; c2->subtype = ct->subtype; c2->flags = ct->flags; + #ifdef PC98 + ct->sname = 0; + #endif ct->name = 0; ct->part = 0; Free_Chunk(ct); *************** *** 177,184 **** --- 206,218 ---- } int + #ifdef PC98 + Add_Chunk(struct disk *d, long offset, u_long size, const char *name, + chunk_e type, int subtype, u_long flags, const char *sname) + #else Add_Chunk(struct disk *d, long offset, u_long size, const char *name, chunk_e type, int subtype, u_long flags) + #endif { struct chunk *c1,*c2,ct; u_long end = offset + size - 1; *************** *** 197,202 **** --- 231,240 ---- c2->offset = c1->offset = offset; c2->size = c1->size = size; c2->end = c1->end = end; + #ifdef PC98 + c1->sname = strdup(sname); + c2->sname = strdup("-"); + #endif c1->name = strdup(name); c2->name = strdup("-"); c1->type = type; *************** *** 206,219 **** --- 244,265 ---- return 0; } if (type == freebsd) + #ifdef PC98 + subtype = 0xc494; + #else subtype = 0xa5; + #endif c1 = 0; + #ifndef PC98 if(!c1 && (type == freebsd || type == fat || type == unknown)) c1 = Find_Mother_Chunk(d->chunks,offset,end,extended); + #endif if(!c1 && (type == freebsd || type == fat || type == unknown)) c1 = Find_Mother_Chunk(d->chunks,offset,end,whole); + #ifndef PC98 if(!c1 && type == extended) c1 = Find_Mother_Chunk(d->chunks,offset,end,whole); + #endif if(!c1 && type == part) c1 = Find_Mother_Chunk(d->chunks,offset,end,freebsd); if(!c1) *************** *** 255,262 **** --- 301,313 ---- size -= offset; doit: + #ifdef PC98 + return Insert_Chunk(c2,offset,size,name, + type,subtype,flags,sname); + #else return Insert_Chunk(c2,offset,size,name, type,subtype,flags); + #endif } } return __LINE__; *************** *** 271,277 **** --- 322,330 ---- if (c->flags & CHUNK_BSD_COMPAT) ret[i++] = 'C'; if (c->flags & CHUNK_ACTIVE) ret[i++] = 'A'; if (c->flags & CHUNK_ALIGN) ret[i++] = '='; + #ifndef PC98 if (c->flags & CHUNK_PAST_1024) ret[i++] = '>'; + #endif if (c->flags & CHUNK_IS_ROOT) ret[i++] = 'R'; ret[i++] = '\0'; return ret; *************** *** 286,293 **** --- 339,351 ---- for(;i'); for(;i<10;i++) putchar(' '); + #ifdef PC98 + printf("%p %8ld %8lu %8lu %-8s %-16s %-8s 0x%02x %s", + c1, c1->offset, c1->size, c1->end, c1->name, c1->sname, + #else printf("%p %8ld %8lu %8lu %-8s %-8s 0x%02x %s", c1, c1->offset, c1->size, c1->end, c1->name, + #endif chunk_n[c1->type],c1->subtype, ShowChunkFlags(c1)); putchar('\n'); *************** *** 301,306 **** --- 359,365 ---- Print_Chunk(c1,2); } + #ifndef PC98 void Bios_Limit_Chunk(struct chunk *c1, u_long limit) { *************** *** 314,319 **** --- 373,379 ---- c1->flags &= ~CHUNK_PAST_1024; } } + #endif int Delete_Chunk(struct disk *d, struct chunk *c) *************** *** 323,334 **** --- 383,398 ---- if(type == whole) return 1; + #ifndef PC98 if(!c1 && (type == freebsd || type == fat || type == unknown)) c1 = Find_Mother_Chunk(d->chunks,c->offset,c->end,extended); + #endif if(!c1 && (type == freebsd || type == fat || type == unknown)) c1 = Find_Mother_Chunk(d->chunks,c->offset,c->end,whole); + #ifndef PC98 if(!c1 && type == extended) c1 = Find_Mother_Chunk(d->chunks,c->offset,c->end,whole); + #endif if(!c1 && type == part) c1 = Find_Mother_Chunk(d->chunks,c->offset,c->end,freebsd); if(!c1) *************** *** 338,343 **** --- 402,411 ---- c2->type = unused; c2->subtype = 0; c2->flags = 0; + #ifdef PC98 + free(c2->sname); + c2->sname = strdup("-"); + #endif free(c2->name); c2->name = strdup("-"); Free_Chunk(c2->part); *************** *** 403,408 **** --- 471,479 ---- *c2 = *c1; c1->next = c2; c1->disk = d; + #ifdef PC98 + c1->sname = strdup("-"); + #endif c1->name = strdup("-"); c1->part = 0; c1->type = unused; diff -arcN libdisk.orig/create_chunk.c libdisk/create_chunk.c *** libdisk.orig/create_chunk.c Wed Mar 29 15:41:00 2000 --- libdisk/create_chunk.c Wed Mar 29 15:41:31 2000 *************** *** 184,214 **** --- 184,232 ---- for(c2 = c1->part; c2 ; c2 = c2->next) { if (c2->type == freebsd) Fixup_FreeBSD_Names(d,c2); + #ifndef PC98 if (c2->type == extended) Fixup_Extended_Names(d,c2); + #endif } } int + #ifdef PC98 + Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags, const char *sname) + #else Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags) + #endif { int i; u_long l; if(!(flags & CHUNK_FORCE_ALL)) { + #ifdef PC98 + /* Never use the first cylinder */ + if (!offset) { + offset += (d->bios_sect * d->bios_hd); + size -= (d->bios_sect * d->bios_hd); + } + #else /* Never use the first track */ if (!offset) { offset += d->bios_sect; size -= d->bios_sect; } + #endif /* Always end on cylinder boundary */ l = (offset+size) % (d->bios_sect * d->bios_hd); size -= l; } + #ifdef PC98 + i = Add_Chunk(d,offset,size,"X",type,subtype,flags,sname); + #else i = Add_Chunk(d,offset,size,"X",type,subtype,flags); + #endif Fixup_Names(d); return i; } *************** *** 230,236 **** --- 248,258 ---- } return 0; found: + #ifdef PC98 + i = Add_Chunk(d,offset,size,"X",type,subtype,flags,"-"); + #else i = Add_Chunk(d,offset,size,"X",type,subtype,flags); + #endif if (i) return 0; Fixup_Names(d); diff -arcN libdisk.orig/disk.c libdisk/disk.c *** libdisk.orig/disk.c Wed Mar 29 15:41:00 2000 --- libdisk/disk.c Wed Mar 29 15:42:01 2000 *************** *** 58,65 **** --- 58,69 ---- struct disklabel dl; char device[64]; struct disk *d; + #ifdef PC98 + unsigned char *p; + #else struct dos_partition *dp; void *p; + #endif u_long offset = 0; strcpy(device,"/dev/r"); *************** *** 96,104 **** --- 100,117 ---- printf("\n"); #endif + /* XXX --- ds.dss_slice[WHOLE_DISK_SLCIE].ds.size of MO disk is wrong!!! */ + #ifdef PC98 + if (!size) + size = dl.d_ncylinders * dl.d_ntracks * dl.d_nsectors; + #else if (!size) size = ds.dss_slices[WHOLE_DISK_SLICE].ds_size; + #endif + #ifdef PC98 + p = (unsigned char*)read_block(fd,1); + #else p = read_block(fd,0); dp = (struct dos_partition*)(p+DOSPARTOFF); for (i=0; i < NDOSPART; i++) { *************** *** 116,121 **** --- 129,135 ---- } free(p); + #endif d->bios_sect = dl.d_nsectors; d->bios_hd = dl.d_ntracks; *************** *** 126,132 **** --- 140,150 ---- if (dl.d_ntracks && dl.d_nsectors) d->bios_cyl = size/(dl.d_ntracks*dl.d_nsectors); + #ifdef PC98 + if (Add_Chunk(d, -offset, size, name, whole, 0, 0, "-")) + #else if (Add_Chunk(d, -offset, size, name, whole, 0, 0)) + #endif #ifdef DEBUG warn("Failed to add 'whole' chunk"); #else *************** *** 134,139 **** --- 152,170 ---- #endif #ifdef __i386__ + #ifdef PC98 + /* XXX -- Quick Hack! + * Check MS-DOG MO + */ + if ((*p == 0xf0 || *p == 0xf8) && + (*(p+1) == 0xff) && + (*(p+2) == 0xff)) { + Add_Chunk(d, 0, size, name, fat, 0xa0a0, 0, name); + free(p); + goto pc98_mo_done; + } + free(p); + #endif /* PC98 */ for(i=BASE_SLICE;ichunks,1024*d->bios_hd*d->bios_sect); + #endif return d; } *************** *** 407,412 **** --- 473,482 ---- continue; } close(fd); + #ifdef PC98 + /* XXX */ + sleep(1); + #endif disks[k++] = strdup(diskname); if(k == MAX_NO_DISKS) return disks; *************** *** 418,423 **** --- 488,494 ---- void Set_Boot_Mgr(struct disk *d, const u_char *b) { + #ifndef PC98 if (d->bootmgr) free(d->bootmgr); if (!b) { *************** *** 427,432 **** --- 498,504 ---- if(!d->bootmgr) err(1,"malloc failed"); memcpy(d->bootmgr,b,DOSPARTOFF); } + #endif } void *************** *** 454,459 **** --- 526,532 ---- { switch (type) { case 0: return "whole"; + #ifndef PC98 case 1: switch (subtype) { case 1: return "fat (12-bit)"; case 2: return "XENIX /"; *************** *** 485,498 **** --- 558,578 ---- case 184: return "bsd/os swap"; default: return "unknown"; } + #endif case 2: return "fat"; case 3: switch (subtype) { + #ifdef PC98 + case 0xc494: return "freebsd"; + #else case 165: return "freebsd"; + #endif default: return "unknown"; } + #ifndef PC98 case 4: return "extended"; case 5: return "part"; case 6: return "unused"; + #endif default: return "unknown"; } } diff -arcN libdisk.orig/libdisk.h libdisk/libdisk.h *** libdisk.orig/libdisk.h Wed Mar 29 15:41:00 2000 --- libdisk/libdisk.h Wed Mar 29 15:41:31 2000 *************** *** 46,51 **** --- 46,54 ---- long offset; u_long size; u_long end; + #ifdef PC98 + char *sname; + #endif char *name; char *oname; /* Used during Fixup_Names() to avoid renaming more than *************** *** 135,142 **** --- 138,150 ---- */ int + #ifdef PC98 + Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, + int subtype, u_long flags, const char *); + #else Create_Chunk(struct disk *disk, u_long offset, u_long size, chunk_e type, int subtype, u_long flags); + #endif /* Create a chunk with the specified paramters */ *************** *** 239,245 **** --- 247,257 ---- void Debug_Chunk(struct chunk *); void Free_Chunk(struct chunk *); struct chunk * Clone_Chunk(struct chunk *); + #ifdef PC98 + int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long, const char *); + #else int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long); + #endif void Bios_Limit_Chunk(struct chunk *, u_long); void * read_block(int, daddr_t); void write_block(int fd, daddr_t block, void *foo); diff -arcN libdisk.orig/rules.c libdisk/rules.c *** libdisk.orig/rules.c Wed Mar 29 15:41:00 2000 --- libdisk/rules.c Wed Mar 29 15:43:16 2000 *************** *** 80,103 **** --- 80,111 ---- void Rule_000(struct disk *d, struct chunk *c, char *msg) { + #ifdef PC98 + int i=0; + #else int i=0,j=0; + #endif struct chunk *c1; if (c->type != whole) return; for (c1=c->part; c1; c1=c1->next) { if (c1->type != unused) continue; + #ifndef PC98 if (c1->flags & CHUNK_ACTIVE) j++; + #endif i++; } if (i > NDOSPART) sprintf(msg+strlen(msg), "%d is too many children of the 'whole' chunk. Max is %d\n", i, NDOSPART); + #ifndef PC98 if (j > 1) sprintf(msg+strlen(msg), "Too many active children of 'whole'"); + #endif } /* *************** *** 116,124 **** --- 124,140 ---- for (i=0, c1=c->part; c1; c1=c1->next) { if (c1->type == unused) continue; c1->flags |= CHUNK_ALIGN; + #ifdef PC98 + if (!Cyl_Aligned(d,c1->offset)) + #else if (!Track_Aligned(d,c1->offset)) + #endif sprintf(msg+strlen(msg), + #ifdef PC98 + "chunk '%s' [%ld..%ld] does not start on a cylinder boundary\n", + #else "chunk '%s' [%ld..%ld] does not start on a track boundary\n", + #endif c1->name,c1->offset,c1->end); if ((c->type == whole || c->end == c1->end) || Cyl_Aligned(d,c1->end+1)) *************** *** 137,142 **** --- 153,159 ---- void Rule_002(struct disk *d, struct chunk *c, char *msg) { + #ifndef PC98 int i; struct chunk *c1; *************** *** 151,156 **** --- 168,174 ---- sprintf(msg+strlen(msg), "Max one 'fat' allowed as child of 'whole'\n"); } + #endif } /* *************** *** 160,165 **** --- 178,184 ---- void Rule_003(struct disk *d, struct chunk *c, char *msg) { + #ifndef PC98 int i; struct chunk *c1; *************** *** 174,179 **** --- 193,199 ---- sprintf(msg+strlen(msg), "Max one 'extended' allowed as child of 'whole'\n"); } + #endif } /* *************** *** 197,205 **** --- 217,227 ---- continue; if (c1->flags & CHUNK_IS_ROOT) { k++; + #ifndef PC98 if (c1->flags & CHUNK_PAST_1024) sprintf(msg+strlen(msg), "Root filesystem extends past cylinder 1024, and cannot be booted from\n"); + #endif } i++; } *************** *** 226,235 **** --- 248,259 ---- if (c->next) Check_Chunk(d,c->next,msg); + #ifndef PC98 if (c->end >= 1024*d->bios_hd*d->bios_sect) c->flags |= CHUNK_PAST_1024; else c->flags &= ~CHUNK_PAST_1024; + #endif } char * *************** *** 252,257 **** --- 276,282 ---- char msg[BUFSIZ]; *msg = '\0'; + #ifndef PC98 if (c->flags & CHUNK_PAST_1024) { strcat(msg, "The root partition must end before cylinder 1024 seen from\n"); *************** *** 259,264 **** --- 284,290 ---- "the BIOS' point of view, or it cannot be booted from.\n"); return strdup(msg); } + #endif for (c1=d->chunks->part;;) { for (; c1; c1=c1->next) if (c1->offset <= c->offset && c1->end >= c->end) *************** *** 273,278 **** --- 299,305 ---- c1 = c1->part; } + #ifndef PC98 if (c1->type != freebsd) { strcat(msg, "The root partition must be in a FreeBSD slice, otherwise\n"); *************** *** 280,285 **** --- 307,313 ---- "the kernel cannot be booted from it\n"); return strdup(msg); } + #endif return NULL; } diff -arcN libdisk.orig/tst01.c libdisk/tst01.c *** libdisk.orig/tst01.c Wed Mar 29 15:41:00 2000 --- libdisk/tst01.c Wed Mar 29 15:41:31 2000 *************** *** 217,223 **** --- 217,227 ---- free(cp); continue; } + #ifdef PC98 + if (!strcasecmp(*cmds,"create") && ncmd == 7) { + #else if (!strcasecmp(*cmds,"create") && ncmd == 6) { + #endif printf("Create=%d\n", Create_Chunk(d, *************** *** 225,231 **** --- 229,240 ---- strtol(cmds[2],0,0), strtol(cmds[3],0,0), strtol(cmds[4],0,0), + #ifdef PC98 + strtol(cmds[5],0,0), + cmds[6])); + #else strtol(cmds[5],0,0))); + #endif continue; } if (!strcasecmp(*cmds,"read")) { *************** *** 276,282 **** --- 285,295 ---- #if 0 printf("\tcollapse [pointer]\n"); #endif + #ifdef PC98 + printf("\tcreate offset size enum subtype flags name\n"); + #else printf("\tcreate offset size enum subtype flags\n"); + #endif printf("\t\tsubtype(part): swap=1, ffs=7\n"); printf("\tdelete pointer\n"); printf("\tlist\n"); diff -arcN libdisk.orig/write_disk.c libdisk/write_disk.c *** libdisk.orig/write_disk.c Wed Mar 29 15:41:00 2000 --- libdisk/write_disk.c Wed Mar 29 15:41:31 2000 *************** *** 29,35 **** --- 29,39 ---- #define DEF_RPM 3600 #define DEF_INTERLEAVE 1 + #ifdef PC98 + #define WHERE(offset,disk) (offset) + #else #define WHERE(offset,disk) (disk->flags & DISK_ON_TRACK ? offset + 63 : offset) + #endif int Write_FreeBSD(int fd, struct disk *new, struct disk *old, struct chunk *c1) { *************** *** 103,113 **** --- 107,123 ---- new->name[0] == 'o' ? DTYPE_SCSI : DTYPE_ESDI; dl->d_partitions[RAW_PART].p_size = c1->size; dl->d_partitions[RAW_PART].p_offset = c1->offset; + #ifdef PC98 + dl->d_rpm = 3600; + dl->d_interleave = 1; + #endif + #ifndef PC98 if(new->flags & DISK_ON_TRACK) for(i=0;id_partitions[i].p_size) dl->d_partitions[i].p_offset += 63; + #endif dl->d_magic = DISKMAGIC; dl->d_magic2 = DISKMAGIC; dl->d_checksum = dkcksum(dl); *************** *** 162,174 **** --- 172,197 ---- char device[64]; u_char *mbr; struct dos_partition *dp,work[NDOSPART]; + #ifdef PC98 + int s[7]; + int PC98_EntireDisk = 0; + #else int s[4]; + #endif int one = 1; int zero = 0; strcpy(device,"/dev/r"); strcat(device,d1->name); + #ifdef PC98 + /* XXX - for entire FreeBSD(98) */ + for (c1 = d1->chunks->part; c1; c1 = c1->next) { + if ((c1->type == freebsd) || (c1->offset == 0)) + device[9] = 0; + } + #endif + fd = open(device,O_RDWR); if (fd < 0) { #ifdef DEBUG *************** *** 179,185 **** --- 202,212 ---- ioctl(fd, DIOCWLABEL, &one); memset(s,0,sizeof s); + #ifdef PC98 + mbr = read_block(fd,WHERE(1,d1)); + #else mbr = read_block(fd,WHERE(0,d1)); + #endif dp = (struct dos_partition*) (mbr + DOSPARTOFF); memcpy(work,dp,sizeof work); dp = work; *************** *** 190,209 **** --- 217,253 ---- #ifndef __alpha__ j = c1->name[4] - '1'; j = c1->name[strlen(d1->name) + 1] - '1'; + #ifdef PC98 + if (j < 0 || j > 7) + #else if (j < 0 || j > 3) + #endif continue; s[j]++; #endif + #ifndef PC98 if (c1->type == extended) ret += Write_Extended(fd, d1,old,c1); + #endif if (c1->type == freebsd) ret += Write_FreeBSD(fd, d1,old,c1); #ifndef __alpha__ + #ifndef PC98 Write_Int32(&dp[j].dp_start, c1->offset); Write_Int32(&dp[j].dp_size, c1->size); + #endif i = c1->offset; + #ifdef PC98 + dp[j].dp_ssect = dp[j].dp_ipl_sct = i % d1->bios_sect; + i -= dp[j].dp_ssect; + i /= d1->bios_sect; + dp[j].dp_shd = dp[j].dp_ipl_head = i % d1->bios_hd; + i -= dp[j].dp_shd; + i /= d1->bios_hd; + dp[j].dp_scyl = dp[j].dp_ipl_cyl = i; + #else if (i >= 1024*d1->bios_sect*d1->bios_hd) { dp[j].dp_ssect = 0xff; dp[j].dp_shd = 0xff; *************** *** 219,224 **** --- 263,269 ---- i -= dp[j].dp_scyl; dp[j].dp_ssect |= i >> 2; } + #endif #ifdef DEBUG printf("S:%lu = (%x/%x/%x)", *************** *** 226,231 **** --- 271,290 ---- #endif i = c1->end; + #ifdef PC98 + #if 1 + dp[j].dp_esect = dp[j].dp_ehd = 0; + dp[j].dp_ecyl = i / (d1->bios_sect * d1->bios_hd); + #else + dp[j].dp_esect = i % d1->bios_sect; + i -= dp[j].dp_esect; + i /= d1->bios_sect; + dp[j].dp_ehd = i % d1->bios_hd; + i -= dp[j].dp_ehd; + i /= d1->bios_hd; + dp[j].dp_ecyl = i; + #endif + #else dp[j].dp_esect = i % d1->bios_sect; i -= dp[j].dp_esect++; i /= d1->bios_sect; *************** *** 236,267 **** --- 295,351 ---- dp[j].dp_ecyl = i; i -= dp[j].dp_ecyl; dp[j].dp_esect |= i >> 2; + #endif #ifdef DEBUG printf(" E:%lu = (%x/%x/%x)\n", c1->end,dp[j].dp_ecyl,dp[j].dp_ehd,dp[j].dp_esect); #endif + #ifdef PC98 + dp[j].dp_mid = c1->subtype & 0xff; + dp[j].dp_sid = c1->subtype >> 8; + if (c1->flags & CHUNK_ACTIVE) + dp[j].dp_mid |= 0x80; + + strncpy(dp[j].dp_name, c1->sname, 16); + #else dp[j].dp_typ = c1->subtype; if (c1->flags & CHUNK_ACTIVE) dp[j].dp_flag = 0x80; else dp[j].dp_flag = 0; #endif + #endif } #ifndef __alpha__ j = 0; for(i=0;ichunks->part; c1; c1 = c1->next) + if (((c1->type == freebsd) || (c1->type == fat)) + && (c1->offset == 0)) + PC98_EntireDisk = 1; + if (PC98_EntireDisk == 0) + write_block(fd,WHERE(1,d1),mbr); + #else mbr = read_block(fd,WHERE(0,d1)); if (d1->bootmgr) memcpy(mbr,d1->bootmgr,DOSPARTOFF); *************** *** 269,274 **** --- 353,359 ---- mbr[512-2] = 0x55; mbr[512-1] = 0xaa; write_block(fd,WHERE(0,d1),mbr); + #endif #endif i = 1;