Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
31
necessary work at a level lower than the DOS to be able to perform disk I/O on
Linux partitions.
The basic method consists of calling Interrupt 0x13 to access the BIOS
(Basic I/O Subsystem) disk routines. This interrupt provides access to many disk
functions (see DOS interrupt list for more details), but the main point of interest
here is the function to read a sector from disk. To activate an interrupt, certain
registers have to be loaded with the values necessary to perform the operation.
To perform a disk read the following registers have to be loaded with these
values:
AH = 0x02
AL = number of sectors to read (must be nonzero)
CH = low eight bits of cylinder number
CL = sector number 1-63 (bits 0-5)
high two bits of cylinder (bits 6-7, hard disk only)
DH = head number
DL = drive number (bit 7 set for hard disk)
ES:BX -> data buffer
Reference: [1]
The AH register specifies the function to be performed, it is loaded with 0x02 as
this is the value that corresponds to the interrupt 0x13 read sector function. The
drive number starts at 0x80 for the first hard disk, 0x81 for the second, etc.
ES:BX are loaded with the memory location to store the data read from disk.
Provided that valid values are loaded into the registers, after issuing
interrupt 0x13 the data read from the disk is stored in the location in memory
pointed to by ES:BX and can be further manipulated as necessary.
5.4 Using Interrupt 0x13 Under MS Windows 95: DPMI
Windows 95, like previous versions of Windows, does not support calling
BIOS disk functions to gain access to hard disks from Win16 and Win32
applications. The reason is that BIOSXLAT.VXD does not translate BIOS
requests to hard disks from protected-mode into V86 mode, and this causes the
ROM BIOS to be called with an invalid address. This means that the method of
issuing an interrupt 0x13 call directly as described above does not work.
However, help is at hand in the form of DPMI - The DOS Protected Mode
Interface. This is available to win16 executables or libraries running under
Windows 3.x and Windows 95. DPMI has a function called simulate real-mode
interrupt and this can be used to call real-mode BIOS disk functions using
interrupt 0x13. When DPMI is used to call interrupt 0x13 BIOS disk functions,
BIOSXLAT.VXD is bypassed and the real-mode BIOS is called, thus solving the
translation problem.