コード例 #1
0
ファイル: disk.c プロジェクト: joshsyu/PQEMU
static void
handle_legacy_disk(struct bregs *regs, u8 extdrive)
{
    if (! CONFIG_DRIVES) {
        // XXX - support handle_1301 anyway?
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    if (extdrive < EXTSTART_HD) {
        struct drive_s *drive_g = getDrive(EXTTYPE_FLOPPY, extdrive);
        if (!drive_g)
            goto fail;
        floppy_13(regs, drive_g);
        return;
    }

    struct drive_s *drive_g;
    if (extdrive >= EXTSTART_CD)
        drive_g = getDrive(EXTTYPE_CD, extdrive - EXTSTART_CD);
    else
        drive_g = getDrive(EXTTYPE_HD, extdrive - EXTSTART_HD);
    if (!drive_g)
        goto fail;
    disk_13(regs, drive_g);
    return;

fail:
    // XXX - support 1301/1308/1315 anyway?
    disk_ret(regs, DISK_RET_EPARAM);
}
コード例 #2
0
ファイル: disk.c プロジェクト: joshsyu/PQEMU
// INT 13h Fixed Disk Services Entry Point
void VISIBLE16
handle_13(struct bregs *regs)
{
    debug_enter(regs, DEBUG_HDL_13);
    u8 extdrive = regs->dl;

    if (CONFIG_CDROM_EMU) {
        if (regs->ah == 0x4b) {
            cdemu_134b(regs);
            return;
        }
        u16 ebda_seg = get_ebda_seg();
        if (GET_EBDA2(ebda_seg, cdemu.active)) {
            u8 emudrive = GET_EBDA2(ebda_seg, cdemu.emulated_extdrive);
            if (extdrive == emudrive) {
                // Access to an emulated drive.
                struct drive_s *cdemu = GET_GLOBAL(cdemu_drive);
                if (regs->ah > 0x16) {
                    // Only old-style commands supported.
                    disk_13XX(regs, cdemu);
                    return;
                }
                disk_13(regs, cdemu);
                return;
            }
            if (extdrive < EXTSTART_CD && ((emudrive ^ extdrive) & 0x80) == 0)
                // Adjust id to make room for emulated drive.
                extdrive--;
        }
    }
    handle_legacy_disk(regs, extdrive);
}
コード例 #3
0
ファイル: disk.c プロジェクト: AhmadQasim/GPU-Virtualization
static void
floppy_13(struct bregs *regs, struct drive_s *drive_gf)
{
    // Only limited commands are supported on floppies.
    switch (regs->ah) {
    case 0x00:
    case 0x01:
    case 0x02:
    case 0x03:
    case 0x04:
    case 0x05:
    case 0x08:
    case 0x15:
    case 0x16:
        disk_13(regs, drive_gf);
        break;
    default:   disk_13XX(regs, drive_gf); break;
    }
}