Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
33
perform the simulate real mode interrupt function. The function is passed two
values by the calling function: the number of the interrupt to simulate, bIntNum
and a pointer to the Real Mode Call Structure, lpCallStruct. These are then used
by a small section of assembly code to perform the interrupt call.
This performs the task of loading the appropriate registers with the values
described in the above section on Using Interrupt 0x13 Under MS Windows 95:
DPMI, and then issuing the interrupt 0x31 call. As can be seen from the above
code, the register are simply loaded with the required values for the function
number for the simulate real mode interrupt function, the number of the interrupt
to simulate and a pointer to the RMCS. If the interrupt produces an error, the
carry flag (CF) is set.
5.6 Layer 0: The ReadPhysicalSector Function
This function is called by the ReadLogicalSector function to read a
physical sector from disk. It takes six arguments:
·
=bDrive - The drive number, 0x80 for 1
st
HDD, 0x81 for 2nd, etc..
·
=wCyl, wHead, wSec - The CHS reference for the sector to be read.
·
=lpBuffer - The pointer to the buffer to read the sector data into.
·
=cbBuffSize - The size of the buffer.
After validating the disk parameters passed to the function, the next task
is to load the Real Mode Call Structure (RMCS) with the appropriate values to
make the interrupt 0x13 call. The values that must be loaded are listed in the
section Using Interrupt 0x13 under MS-DOS above, but are listed again here
for clarity:
AH = 0x02
AL = number of sectors to read (must be nonzero)
_asm {
push di
mov ax, 0x300
// DPMI Simulate Real Mode Int
mov bl, bIntNum
// Number of the interrupt to simulate
mov bh, 0x01
// Bit 0 = 1; all other bits must be 0
xor cx, cx
// No words to copy
les di, lpCallStruct
int 0x31
// Call DPMI
jc
END1
// CF set if error occurred
mov fRetVal, TRUE
END1:
pop di
}