--- qemu/roms/seabios/src/floppy.c 2018/04/24 17:36:48 1.1.1.1 +++ 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,13 +121,7 @@ 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() +floppy_setup(void) { if (! CONFIG_FLOPPY) return; @@ -159,7 +161,7 @@ find_floppy_type(u32 size) ****************************************************************/ static void -floppy_reset_controller() +floppy_reset_controller(void) { // Reset controller u8 val8 = inb(PORT_FD_DOR); @@ -172,7 +174,7 @@ floppy_reset_controller() } static int -wait_floppy_irq() +wait_floppy_irq(void) { ASSERT16(); u8 v; @@ -182,7 +184,9 @@ wait_floppy_irq() 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; @@ -570,7 +574,7 @@ process_floppy_op(struct disk_op_s *op) // INT 0Eh Diskette Hardware ISR Entry Point void VISIBLE16 -handle_0e() +handle_0e(void) { debug_isr(DEBUG_ISR_0e); if (! CONFIG_FLOPPY) @@ -593,7 +597,7 @@ done: // Called from int08 handler. void -floppy_tick() +floppy_tick(void) { if (! CONFIG_FLOPPY) return;