本文整理汇总了C++中disk_ret函数的典型用法代码示例。如果您正苦于以下问题:C++ disk_ret函数的具体用法?C++ disk_ret怎么用?C++ disk_ret使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disk_ret函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
示例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);
}