Exemple #1
0
// Perform read/write/verify using new-style "int13ext" accesses.
static void noinline
extended_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
{
    struct disk_op_s dop;
    // Get lba and check.
    dop.lba = GET_INT13EXT(regs, lba);
    dop.command = command;
    dop.drive_g = drive_g;
    if (dop.lba >= GET_GLOBAL(drive_g->sectors)) {
        warn_invalid(regs);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    dop.buf_fl = SEGOFF_TO_FLATPTR(GET_INT13EXT(regs, data));
    dop.count = GET_INT13EXT(regs, count);
    if (! dop.count) {
        // Nothing to do.
        disk_ret(regs, DISK_RET_SUCCESS);
        return;
    }

    int status = send_disk_op(&dop);

    SET_INT13EXT(regs, count, dop.count);

    disk_ret(regs, status);
}
Exemple #2
0
// Perform read/write/verify using new-style "int13ext" accesses.
static void
extended_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
{
    struct disk_op_s dop;
    // Get lba and check.
    dop.lba = GET_INT13EXT(regs, lba);
    dop.command = command;
    dop.drive_g = drive_g;
    if (dop.lba >= GET_GLOBAL(drive_g->sectors)) {
        dprintf(1, "int13_harddisk: function %02x. LBA out of range\n"
                , regs->ah);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    dop.buf_fl = SEGOFF_TO_FLATPTR(GET_INT13EXT(regs, data));
    dop.count = GET_INT13EXT(regs, count);

    int status = send_disk_op(&dop);

    SET_INT13EXT(regs, count, dop.count);

    disk_ret(regs, status);
}