MORE INFORMATION
The following information covers the 80286/80386 platforms as all
microprocessors start up in real mode and jump to a "hard-wired" address in
higher memory.
When the power is turned on, the microprocessor by default begins execution
with the CS:IP register set to FFFF:0000H. This location typically has a
jump address in the ROM BIOS that contains the initialization code for the
machine. For example:
-------------------------------------- <--FFFF:000FH
| | <--FFFF:0000H
| |
-------------------------------------- <--F000:000H
(Physical address:FFFF0H)
The address of FFFF:000F translates to a physical address of FFFFFH, which
is actually 1 MB. This implies that the 20 (A0-A19) lines of the address
bus have been enabled. Please note that all interrupts are disabled when
the microprocessor starts execution. Therefore, it is up to the
initialization routine to set up the interrupt vectors at the base of the
memory.
We then go through the initialization process and reach a point where the
SYSINIT routine in MSDOS.SYS reads the CONFIG.SYS file.
At this point, the HIMEM driver goes through an initialization process
where it checks for a variety of things such as pre-existing XMS drivers,
extended memory, etc. On passing that test successfully, the HIMEM driver
loads itself into lower memory and then proceeds to set up the vector
routines.
The MS-DOS LAN Manager redirector has two code segments, the lower and the
upper. The upper code segment is addressed using a far pointer scheme,
whether or not HIMEM is loaded. When the redirector loads, it checks
whether the HIMEM parameter has been commented, enabled, or disabled. It
checks whether the HIMEM driver has been loaded by loading the AX register
with 4300H and calling interrupt 2FH, which sets the AL register to 80H if
HIMEM is loaded.
The MS-DOS LAN Manager redirector then makes a request for the high memory
area from HIMEM. This is achieved by loading the AH and DX registers with
01H and FFFFH respectively, and calling interrupt 2FH. This routine also
checks whether or not some other program has turned the A20 memory address
line on, and helps register the redirector with HIMEM. This gives the
redirector the capability to use the routines provided by HIMEM.
It is the application's responsibility to toggle the A20 line to gain
access to the HMA. HIMEM provides a function to do this called Global
Enable A20. After the redirector has enabled the A20 line, it has access to
the HMA from memory location FFFF:0010 (1024K) to FFFF:FFFFH (1088K).
The redirector then calls another function called Move Extended Memory
Block, and moves its upper code segment into the HMA. For the lower code
segment to access the upper, it must load the code segment with FFFFH and
the IP register with 0010H.
NOTE: Toggling the A20 line is controlled by hardware. HIMEM implements
this function by providing a routine to control the hardware. As with any
MS-DOS application, you can implement your own routine to enable and
disable A20, as there is no protection to stop any application from doing
so.
Currently, the only way to use the HMA (bypassing HIMEM) after having
loaded the redirector is to do the following:
- Obtain a memory size map of the redirector in the HMA.
- Offset your IP register by memory size by using segment FFFFH. The
current method to obtain the size of the redirector in memory is to
either use tools such as ARENA or MEM /DEBUG or use ROM BIOS functions.
If you use ARENA, you will get a map for segment FFFF:0000H, and the
segment will be marked as active. Because it is the redirector that is
using that part of memory, you can calculate the offset required. In the
case of MEM /DEBUG, you are required to know the size of the executable
from which you are supposed to subtract the value obtained for the
lower code segment.
A future release of MS-DOS LAN Manager should contain a function that will
determine the size of the redirector in the HMA.