• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ disk_ret函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中disk_ret函数的典型用法代码示例。如果您正苦于以下问题:C++ disk_ret函数的具体用法?C++ disk_ret怎么用?C++ disk_ret使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了disk_ret函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: disk_1305

// format disk track
static void
disk_1305(struct bregs *regs, struct drive_s *drive_g)
{
    debug_stub(regs);

    u16 nlc, nlh, nlspt;
    fillLCHS(drive_g, &nlc, &nlh, &nlspt);

    u8 num_sectors = regs->al;
    u8 head        = regs->dh;

    if (head >= nlh || num_sectors == 0 || num_sectors > nlspt) {
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    struct disk_op_s dop;
    dop.drive_g = drive_g;
    dop.command = CMD_FORMAT;
    dop.lba = head;
    dop.count = num_sectors;
    dop.buf_fl = MAKE_FLATPTR(regs->es, regs->bx);
    int status = send_disk_op(&dop);
    disk_ret(regs, status);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:26,代码来源:disk.c


示例2: handle_legacy_disk

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);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:31,代码来源:disk.c


示例3: disk_1305

// format disk track
static void noinline
disk_1305(struct bregs *regs, struct drive_s *drive_gf)
{
    debug_stub(regs);

    struct chs_s chs = getLCHS(drive_gf);
    u16 nlc=chs.cylinder, nlh=chs.head, nls=chs.sector;

    u8 count = regs->al;
    u8 cylinder = regs->ch;
    u8 head = regs->dh;

    if (cylinder >= nlc || head >= nlh || count == 0 || count > nls) {
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    struct disk_op_s dop;
    dop.drive_gf = drive_gf;
    dop.command = CMD_FORMAT;
    dop.lba = (((u32)cylinder * (u32)nlh) + (u32)head) * (u32)nls;
    dop.count = count;
    dop.buf_fl = MAKE_FLATPTR(regs->es, regs->bx);
    int status = send_disk_op(&dop);
    disk_ret(regs, status);
}
开发者ID:KevinOConnor,项目名称:seabios,代码行数:27,代码来源:disk.c


示例4: extended_access

// 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);
}
开发者ID:MrPavel3243,项目名称:limbo-android,代码行数:29,代码来源:disk.c


示例5: disk_1346

// IBM/MS eject media
static void
disk_1346(struct bregs *regs, struct drive_s *drive_g)
{
    if (regs->dl < EXTSTART_CD) {
        // Volume Not Removable
        disk_ret(regs, DISK_RET_ENOTREMOVABLE);
        return;
    }

    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_EBDA(cdrom_locks[cdid]);
    if (locks != 0) {
        disk_ret(regs, DISK_RET_ELOCKED);
        return;
    }

    // FIXME should handle 0x31 no media in device
    // FIXME should handle 0xb5 valid request failed

    // Call removable media eject
    struct bregs br;
    memset(&br, 0, sizeof(br));
    br.ah = 0x52;
    call16_int(0x15, &br);

    if (br.ah || br.flags & F_CF) {
        disk_ret(regs, DISK_RET_ELOCKED);
        return;
    }
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:32,代码来源:disk.c


示例6: extended_access

// Perform read/write/verify using new-style "int13ext" accesses.
static void noinline
extended_access(struct bregs *regs, struct drive_s *drive_gf, u16 command)
{
    struct disk_op_s dop;
    struct int13ext_s *param_far = (struct int13ext_s*)(regs->si+0);
    // Get lba and check.
    dop.lba = GET_FARVAR(regs->ds, param_far->lba);
    dop.command = command;
    dop.drive_gf = drive_gf;
    if (dop.lba >= GET_GLOBALFLAT(drive_gf->sectors)) {
        warn_invalid(regs);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    dop.buf_fl = SEGOFF_TO_FLATPTR(GET_FARVAR(regs->ds, param_far->data));
    dop.count = GET_FARVAR(regs->ds, param_far->count);
    if (! dop.count) {
        // Nothing to do.
        disk_ret(regs, DISK_RET_SUCCESS);
        return;
    }

    int status = send_disk_op(&dop);

    SET_FARVAR(regs->ds, param_far->count, dop.count);

    disk_ret(regs, status);
}
开发者ID:KevinOConnor,项目名称:seabios,代码行数:30,代码来源:disk.c


示例7: disk_1316

static void
disk_1316(struct bregs *regs, struct drive_s *drive_g)
{
    if (regs->dl >= EXTSTART_HD) {
        // Hard drive
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }
    disk_ret(regs, DISK_RET_ECHANGED);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:10,代码来源:disk.c


示例8: disk_1308

// read disk drive parameters
static void noinline
disk_1308(struct bregs *regs, struct drive_s *drive_g)
{
    u16 ebda_seg = get_ebda_seg();
    // Get logical geometry from table
    u16 nlc, nlh, nlspt;
    fillLCHS(drive_g, &nlc, &nlh, &nlspt);
    nlc--;
    nlh--;
    u8 count;
    if (regs->dl < EXTSTART_HD) {
        // Floppy
        count = GET_GLOBAL(FloppyCount);

        if (CONFIG_CDROM_EMU
            && drive_g == GLOBALFLAT2GLOBAL(GET_GLOBAL(cdemu_drive_gf)))
            regs->bx = GET_EBDA2(ebda_seg, cdemu.media) * 2;
        else
            regs->bx = GET_GLOBAL(drive_g->floppy_type);

        // set es & di to point to 11 byte diskette param table in ROM
        regs->es = SEG_BIOS;
        regs->di = (u32)&diskette_param_table2;
    } else if (regs->dl < EXTSTART_CD) {
        // Hard drive
        count = GET_BDA(hdcount);
        nlc--;  // last sector reserved
    } else {
        // Not supported on CDROM
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    if (CONFIG_CDROM_EMU && GET_EBDA2(ebda_seg, cdemu.active)) {
        u8 emudrive = GET_EBDA2(ebda_seg, cdemu.emulated_extdrive);
        if (((emudrive ^ regs->dl) & 0x80) == 0)
            // Note extra drive due to emulation.
            count++;
        if (regs->dl < EXTSTART_HD && count > 2)
            // Max of two floppy drives.
            count = 2;
    }

    regs->al = 0;
    regs->ch = nlc & 0xff;
    regs->cl = ((nlc >> 2) & 0xc0) | (nlspt & 0x3f);
    regs->dh = nlh;

    disk_ret(regs, DISK_RET_SUCCESS);
    regs->dl = count;
}
开发者ID:MrPavel3243,项目名称:limbo-android,代码行数:52,代码来源:disk.c


示例9: disk_134500

// lock
static void
disk_134500(struct bregs *regs, struct drive_s *drive_gf)
{
    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_LOW(CDRom_locks[cdid]);
    if (locks == 0xff) {
        regs->al = 1;
        disk_ret(regs, DISK_RET_ETOOMANYLOCKS);
        return;
    }
    SET_LOW(CDRom_locks[cdid], locks + 1);
    regs->al = 1;
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:KevinOConnor,项目名称:seabios,代码行数:15,代码来源:disk.c


示例10: disk_134500

// lock
static void
disk_134500(struct bregs *regs, struct drive_s *drive_g)
{
    u16 ebda_seg = get_ebda_seg();
    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_EBDA2(ebda_seg, cdrom_locks[cdid]);
    if (locks == 0xff) {
        regs->al = 1;
        disk_ret(regs, DISK_RET_ETOOMANYLOCKS);
        return;
    }
    SET_EBDA2(ebda_seg, cdrom_locks[cdid], locks + 1);
    regs->al = 1;
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:16,代码来源:disk.c


示例11: disk_134501

// unlock
static void
disk_134501(struct bregs *regs, struct drive_s *drive_gf)
{
    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_LOW(CDRom_locks[cdid]);
    if (locks == 0x00) {
        regs->al = 0;
        disk_ret(regs, DISK_RET_ENOTLOCKED);
        return;
    }
    locks--;
    SET_LOW(CDRom_locks[cdid], locks);
    regs->al = (locks ? 1 : 0);
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:KevinOConnor,项目名称:seabios,代码行数:16,代码来源:disk.c


示例12: cdemu_134b

// ElTorito - Terminate disk emu
void
cdemu_134b(struct bregs *regs)
{
    // FIXME ElTorito Hardcoded
    SET_INT13ET(regs, size, 0x13);
    SET_INT13ET(regs, media, GET_LOW(CDEmu.media));
    SET_INT13ET(regs, emulated_drive, GET_LOW(CDEmu.emulated_extdrive));
    struct drive_s *drive_gf = GET_LOW(CDEmu.emulated_drive_gf);
    u8 cntl_id = 0;
    if (drive_gf)
        cntl_id = GET_GLOBALFLAT(drive_gf->cntl_id);
    SET_INT13ET(regs, controller_index, cntl_id / 2);
    SET_INT13ET(regs, device_spec, cntl_id % 2);
    SET_INT13ET(regs, ilba, GET_LOW(CDEmu.ilba));
    SET_INT13ET(regs, buffer_segment, GET_LOW(CDEmu.buffer_segment));
    SET_INT13ET(regs, load_segment, GET_LOW(CDEmu.load_segment));
    SET_INT13ET(regs, sector_count, GET_LOW(CDEmu.sector_count));
    SET_INT13ET(regs, cylinders, GET_LOW(CDEmu.lchs.cylinders));
    SET_INT13ET(regs, sectors, GET_LOW(CDEmu.lchs.spt));
    SET_INT13ET(regs, heads, GET_LOW(CDEmu.lchs.heads));

    // If we have to terminate emulation
    if (regs->al == 0x00) {
        // FIXME ElTorito Various. Should be handled accordingly to spec
        SET_LOW(CDEmu.active, 0x00); // bye bye

        // XXX - update floppy/hd count.
    }

    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:OpenXT-Extras,项目名称:seabios,代码行数:32,代码来源:cdrom.c


示例13: disk_134501

// unlock
static void
disk_134501(struct bregs *regs, struct drive_s *drive_g)
{
    u16 ebda_seg = get_ebda_seg();
    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_EBDA2(ebda_seg, cdrom_locks[cdid]);
    if (locks == 0x00) {
        regs->al = 0;
        disk_ret(regs, DISK_RET_ENOTLOCKED);
        return;
    }
    locks--;
    SET_EBDA2(ebda_seg, cdrom_locks[cdid], locks);
    regs->al = (locks ? 1 : 0);
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:17,代码来源:disk.c


示例14: disk_1341

// IBM/MS installation check
static void
disk_1341(struct bregs *regs, struct drive_s *drive_g)
{
    regs->bx = 0xaa55;  // install check
    regs->cx = 0x0007;  // ext disk access and edd, removable supported
    disk_ret(regs, DISK_RET_SUCCESS);
    regs->ah = 0x30;    // EDD 3.0
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:9,代码来源:disk.c


示例15: disk_134502

// status
static void
disk_134502(struct bregs *regs, struct drive_s *drive_g)
{
    int cdid = regs->dl - EXTSTART_CD;
    u8 locks = GET_EBDA(cdrom_locks[cdid]);
    regs->al = (locks ? 1 : 0);
    disk_ret(regs, DISK_RET_SUCCESS);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:9,代码来源:disk.c


示例16: disk_1300

// disk controller reset
static void
disk_1300(struct bregs *regs, struct drive_s *drive_g)
{
    struct disk_op_s dop;
    dop.drive_g = drive_g;
    dop.command = CMD_RESET;
    int status = send_disk_op(&dop);
    disk_ret(regs, status);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:10,代码来源:disk.c


示例17: basic_access

// Perform read/write/verify using old-style chs accesses
static void
basic_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
{
    struct disk_op_s dop;
    dop.drive_g = drive_g;
    dop.command = command;

    u8 count = regs->al;
    u16 cylinder = regs->ch | ((((u16)regs->cl) << 2) & 0x300);
    u16 sector = regs->cl & 0x3f;
    u16 head = regs->dh;

    if (count > 128 || count == 0 || sector == 0) {
        dprintf(1, "int13_harddisk: function %02x, parameter out of range!\n"
                , regs->ah);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }
    dop.count = count;

    u16 nlc, nlh, nlspt;
    fillLCHS(drive_g, &nlc, &nlh, &nlspt);

    // sanity check on cyl heads, sec
    if (cylinder >= nlc || head >= nlh || sector > nlspt) {
        dprintf(1, "int13_harddisk: function %02x, parameters out of"
                " range %04x/%04x/%04x!\n"
                , regs->ah, cylinder, head, sector);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    // translate lchs to lba
    dop.lba = (((((u32)cylinder * (u32)nlh) + (u32)head) * (u32)nlspt)
               + (u32)sector - 1);

    dop.buf_fl = MAKE_FLATPTR(regs->es, regs->bx);

    int status = send_disk_op(&dop);

    regs->al = dop.count;

    disk_ret(regs, status);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:45,代码来源:disk.c


示例18: disk_1310

// check drive ready
static void
disk_1310(struct bregs *regs, struct drive_s *drive_g)
{
    // should look at 40:8E also???

    struct disk_op_s dop;
    dop.drive_g = drive_g;
    dop.command = CMD_ISREADY;
    int status = send_disk_op(&dop);
    disk_ret(regs, status);
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:12,代码来源:disk.c


示例19: basic_access

// Perform read/write/verify using old-style chs accesses
static void noinline
basic_access(struct bregs *regs, struct drive_s *drive_g, u16 command)
{
    struct disk_op_s dop;
    dop.drive_g = drive_g;
    dop.command = command;

    u8 count = regs->al;
    u16 cylinder = regs->ch | ((((u16)regs->cl) << 2) & 0x300);
    u16 sector = regs->cl & 0x3f;
    u16 head = regs->dh;

    if (count > 128 || count == 0 || sector == 0) {
        warn_invalid(regs);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }
    dop.count = count;

    u16 nlc, nlh, nlspt;
    fillLCHS(drive_g, &nlc, &nlh, &nlspt);

    // sanity check on cyl heads, sec
    if (cylinder >= nlc || head >= nlh || sector > nlspt) {
        warn_invalid(regs);
        disk_ret(regs, DISK_RET_EPARAM);
        return;
    }

    // translate lchs to lba
    dop.lba = (((((u32)cylinder * (u32)nlh) + (u32)head) * (u32)nlspt)
               + (u32)sector - 1);

    dop.buf_fl = MAKE_FLATPTR(regs->es, regs->bx);

    int status = send_disk_op(&dop);

    regs->al = dop.count;

    disk_ret(regs, status);
}
开发者ID:MrPavel3243,项目名称:limbo-android,代码行数:42,代码来源:disk.c


示例20: disk_1349

// IBM/MS extended media change
static void
disk_1349(struct bregs *regs, struct drive_s *drive_g)
{
    if (regs->dl < EXTSTART_CD) {
        // Always success for HD
        disk_ret(regs, DISK_RET_SUCCESS);
        return;
    }
    set_invalid(regs);
    // always send changed ??
    regs->ah = DISK_RET_ECHANGED;
}
开发者ID:joshsyu,项目名称:PQEMU,代码行数:13,代码来源:disk.c



注:本文中的disk_ret函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ disk_to_dev函数代码示例发布时间:2022-05-30
下一篇:
C++ disk_readp函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap