Get Raw Mode Switch Addresses


This function returns addresses that can be jumped to
for low-level mode switching.

To Call

AX = 0306h

Returns

If function was successful:
Carry flag is clear
BX:CX = Real -> Protected mode switch address
SI:(E)DI = Protected -> Real mode switch address

If function was not successful:
Carry flag is set

Parameters To State-Save Procedures

Execute a far jump to the appropriate address (real or
pmode) with:
AX = New DS
CX = New ES
DX = New SS
(E)BX = New (E)SP
SI = New CS
(E)DI = New (E)IP

The processor will be placed in the desired mode. The
DS, ES, SS, (E)SP, CS, and (E)IP will contain the
values specified. The (E)BP register will be preserved
across the call and so can be used as a pointer. The
values in (E)AX, (E)BX, (E)CX, (E)DX, (E)SI, and (E)DI
will be undefined. On an 80386 or 80486 the FS and GS
segment registers will contain zero after the mode
switch.

Programmer's Notes

o The address returned in BX:CX must only be called
in real mode to switch into protected mode. The
address returned in SI:(E)DI must only be called
in protected mode to switch into real mode.
o 16-bit programs should call the address returned
in SI:DI to switch from protected to real mode.
32-bit programs should call the address returned
in SI:EDI.
o It is up to the caller to save and restore the
state of the task when using this function to
switch modes. This usually requires using the
state save function (see function 0600H).
o The parameters must contain segment values
appropriate for the mode that is being switched
to. If invalid selectors are specified when
switching into protected mode, an exception will
occur.
o Applications may find functions 0300h, 0301h,
0302h, and 0304h more convenient to use than using
this type of mode switching.