DOS/32 Advanced DOS Extender - Programmer's Reference

2.29 - DPMI function 0306h - Get Raw Mode Switch Addresses

Returns addresses that can be called for low-level mode switching.


In: AX = 0306h
Out: CF clear
BX:CX = real-to-protected mode switch address
SI:EDI = protected-to-real mode switch address


a) The address returned in BX:CX must only be called in real mode to switch into protected mode. The address returned in SI:EDI must only be called in protected mode to switch into real mode.

b) The mode switch procedures are entered by a FAR JMP to the appropriate address with the following parameters:

AX = new DS
CX = new ES
DX = new SS
(E)BX = new (E)SP
SI = new CS
(E)DI = new (E)IP

The processor is placed into the desired mode, and the DS, ES, SS, (E)SP, CS, and (E)IP registers are updated with the specified values; in other words, execution of the client continues in the requested mode at the address provided in registers SI:EDI. The values specified to be placed into the segment registers must be appropriate for the destination mode; if invalid selectors are supplied when switching into protected mode, an exception will occur.

The values in (E)AX, (E)BX, (E)CX, (E)DX, (E)SI, and (E)DI after the mode switch are undefined. (E)BP will be preserved across the mode switch call so it can be used as a pointer. The FS and GS segment registers will contain zero after the mode switch.

If interrupts are disabled when the mode switch procedure is invoked, they will not be re-enabled by the DPMI host (even temporarily).

c) It is up to the client to save and restore the state of the task when using this function to switch modes. This usually requires using the state save/restore procedures whose addresses are returned by DPMI function 0305h.

d) Clients may find it more convenient to use DPMI functions 0300h, 0301h, and 0302h for mode switching than this function.


Copyright Supernar Systems, Ltd. 1996-2005
All Rights Reserved.