10 * Reset the disk system using INT 13,0. Forces both hard disks and
11 * floppy disks to seek back to track 0.
14 static void disk_init ( void ) {
15 REAL_EXEC ( rm_disk_init,
24 CLOBBER ( "eax", "ebx", "ecx", "edx",
25 "ebp", "esi", "edi" ) );
29 * Read a single sector from a disk using INT 13,2.
31 * Returns the BIOS status code (%ah) - 0 indicates success
34 static unsigned int pcbios_disk_read ( int drive, int cylinder, int head,
35 int sector, struct disk_sector *buf ) {
36 uint16_t basemem_buf, status, flags;
37 int discard_c, discard_d;
39 basemem_buf = BASEMEM_PARAMETER_INIT ( *buf );
40 REAL_EXEC ( rm_pcbios_disk_read,
42 "movw $0x0201, %%ax\n\t" /* Read a single sector */
48 OUT_CONSTRAINTS ( "=a" ( status ), "=b" ( flags ),
49 "=c" ( discard_c ), "=d" ( discard_d ) ),
50 IN_CONSTRAINTS ( "c" ( ( ( cylinder & 0xff ) << 8 ) |
51 ( ( cylinder >> 8 ) & 0x3 ) |
53 "d" ( ( head << 8 ) | drive ),
54 "b" ( basemem_buf ) ),
55 CLOBBER ( "ebp", "esi", "edi" ) );
56 BASEMEM_PARAMETER_DONE ( *buf );
58 return ( flags & CF ) ? ( status >> 8 ) : 0;