// 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); }
static int ramdisk_copy(struct disk_op_s *op, int iswrite) { u32 offset = GET_GLOBAL(op->drive_g->cntl_id); offset += (u32)op->lba * DISK_SECTOR_SIZE; u64 opd = GDT_DATA | GDT_LIMIT(0xfffff) | GDT_BASE((u32)op->buf_fl); u64 ramd = GDT_DATA | GDT_LIMIT(0xfffff) | GDT_BASE(offset); u64 gdt[6]; if (iswrite) { gdt[2] = opd; gdt[3] = ramd; } else { gdt[2] = ramd; gdt[3] = opd; } // Call int 1587 to copy data. struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_CF|F_IF; br.ah = 0x87; br.es = GET_SEG(SS); br.si = (u32)gdt; br.cx = op->count * DISK_SECTOR_SIZE / 2; call16_int(0x15, &br); if (br.flags & F_CF) return DISK_RET_EBADTRACK; return DISK_RET_SUCCESS; }
// Call int10 vga handler. static void call16_int10(struct bregs *br) { br->flags = F_IF; start_preempt(); call16_int(0x10, br); finish_preempt(); }
// Show a character on the screen. static void screenc(char c) { struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; br.ah = 0x0e; br.al = c; call16_int(0x10, &br); }
// Begin the boot process by invoking an int0x19 in 16bit mode. void VISIBLE32FLAT startBoot(void) { // Clear low-memory allocations (required by PMM spec). memset((void*)BUILD_STACK_ADDR, 0, BUILD_EBDA_MINIMUM - BUILD_STACK_ADDR); dprintf(3, "Jump to int19\n"); struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; call16_int(0x19, &br); }
// Begin the boot process by invoking an int0x19 in 16bit mode. void VISIBLE32FLAT startBoot(void) { // Clear low-memory allocations (required by PMM spec). memset((void*)BUILD_STACK_ADDR, 0, BUILD_EBDA_MINIMUM - BUILD_STACK_ADDR); dprintf(3, "Jump to int19\n"); //Tell QEMU the POST is done pci_config_writel(pci_to_bdf(0, 0, 0), PCI_VENDOR_ID, 0xB105DEAD); struct bregs br; memset(&br, 0, sizeof(br)); br.flags = F_IF; call16_int(0x19, &br); }