Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
32
DPMI is accessed through another interrupt - interrupt 0x31. Again
registers have to be loaded with the correct values before executing the interrupt.
These values are:
AX = 0x0300
BL = interrupt number
BH = flags
bit 0: reset the interrupt controller and A20 line (DPMI 0.9)
reserved, must be 0 (DPMI 1.0+)
others: reserved, must be 0
CX = number of words to copy from protected mode to real mode stack
ES:(E)DI = selector:offset of real mode call structure
Reference: [1]
The values for the real-mode (interrupt 0x13) interrupt are placed in a structure
called the real-mode call structure. This structure contains elements
corresponding the registers. The values are assigned to these variables that
would normally be loaded into the registers when performing an interrupt 0x13
call. Using this method DPMI allows access to the hard disk as if a genuine
interrupt 0x13 was being called. Using DPMI to simulate interrupt 0x13 calls it
can be seen that it is possible for win16 libraries or executables to directly
access non-DOS hard disks from within windows. It is upon this method that the
low level disk access sections of the ext2lib library were built.
5.5 Layer 0: The SimulateRMInt Function
It is this function that implements the simulate real mode interrupt function
of DPMI. This function will simulate any real mode interrupt, but is used
exclusively to implement interrupt 0x13 calls to access the BIOS disk functions.
It is called from the ReadPhysicalSector function to actually call the BIOS
to perform the disk read. To simulate the interrupt 0x13 call, the DPMI simulate
real mode interrupt function requires a data structure called the Real Mode Call
Structure (RMCS) to be filed with the register values for the real mode call. This
data structure is shown below:
As can be seen from the above structure, it has variables that correspond to the
cpu registers that would normally be loaded with values prior to issuing an
interupt call. This structure is then used to make the interrupt 0x31 call to
typedef struct tagRMCS {
DWORD edi, esi, ebp, RESERVED, ebx, edx, ecx, eax;
WORD wFlags, es, ds, fs, gs, ip, cs, sp, ss;
} RMCS, FAR* LPRMCS;