Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
35
A DISKINFO structure is used for each disk on the system and they are
held in an array of MAX_DISKS length. The disk geometry is stored in the array
rgDiskParams, The values are as follows:
·
=rgDiskParams[0] = drive number
·
=rgDiskParams[1] = maximum cylinder number
·
=rgDiskParams[2] = maximum head number
·
=rgDiskParams[3] = maximum sector number
The FirstSec value is discussed in section 5.8
The BIOS disk function to retrieve the disk parameters is function 0x08 of
interrupt 0x13. The RMCS is loaded with the following values
AH = 0x08
DL = drive (bit 7 set for hard disk)
Reference: [1]
SimulateRMInt is then called to issue the interrupt. The following values are
returned by the interrupt:
CF set on error
AH = status (0x07)
CF clear if successful
AH = 00h
AL = 00h on at least some BIOSes
BL = drive type (AT/PS2 floppies only)
CH = low eight bits of maximum cylinder number
CL = maximum sector number (bits 5-0)
high two bits of maximum cylinder number (bits 7-6)
DH = maximum head number
DL = number of drives
Reference: [1]
These are copied into the rgDiskParams array This process is repeated
for each disk found by the BIOS. The function then returns TRUE for success or
FALSE if the SimulateRMInt call was unsuccessful.
GetDiskParams is called once during execution of the library, when the
library is first loaded.
5.8 Layer 0: The ReadPartInfo Function
This function uses the ReadPhysicalSector function to read the first sector
from each disk recorded in the rgDiskParams array into the firstsector structure.
The DISKINFO data type, introduced in the above section, is used to store the
drive geometry and the first sector of each hard disk connected to the PC. The
firstsector structure stores this first sector. Its structure is shown below:
struct firstsector {
unsigned char Fill[0x1be];
struct partition Part[4];
unsigned short
Magic;
/* Must be FIRST_SECT_MAGIC */
};