--- qemu/roms/seabios/src/floppy.c 2018/04/24 17:52:14 1.1.1.2 +++ qemu/roms/seabios/src/floppy.c 2018/04/24 18:27:40 1.1.1.3 @@ -96,14 +96,22 @@ addFloppy(int floppyid, int ftype, int d return NULL; } - struct drive_s *drive_g = allocDrive(); - if (!drive_g) + char *desc = malloc_tmp(MAXDESCSIZE); + struct drive_s *drive_g = malloc_fseg(sizeof(*drive_g)); + if (!drive_g || !desc) { + warn_noalloc(); + free(desc); + free(drive_g); return NULL; + } + memset(drive_g, 0, sizeof(*drive_g)); drive_g->cntl_id = floppyid; drive_g->type = driver; drive_g->blksize = DISK_SECTOR_SIZE; drive_g->floppy_type = ftype; drive_g->sectors = (u64)-1; + drive_g->desc = desc; + snprintf(desc, MAXDESCSIZE, "drive %c", 'A' + floppyid); memcpy(&drive_g->lchs, &FloppyInfo[ftype].chs , sizeof(FloppyInfo[ftype].chs)); @@ -113,12 +121,6 @@ addFloppy(int floppyid, int ftype, int d } void -describe_floppy(struct drive_s *drive_g) -{ - printf("drive %c", 'A' + drive_g->cntl_id); -} - -void floppy_setup(void) { if (! CONFIG_FLOPPY) @@ -182,7 +184,9 @@ wait_floppy_irq(void) v = GET_BDA(floppy_recalibration_status); if (v & FRS_TIMEOUT) break; - wait_irq(); + // Could use wait_irq() here, but that causes issues on + // bochs, so use yield() instead. + yield(); } v &= ~FRS_TIMEOUT;