Previous: Function 0301 - Call Real Mode Procedure With Far Return Frame To the Table of Content Next: Function 0303 - Allocate Real Mode Callback Address

- 7.2.23 -
PMODE/W MSDOS Extender
PMODE/W Supported DPMI INT 31h functions

Function 0302 - Call Real Mode Procedure With IRET Frame

PMODE/W API

This function Simulates a FAR CALL with flags pushed on the stack to a real mode routine. The real mode procedure must return by executing an IRET instruction or a RETF 2.
In:
   AX     = 0302h
   BH     = must be 0
   CX     = number of words to copy from the protected
            mode stack to the real mode stack
   ES:EDI = selector:offset of real mode register data
            structure in the following format:
     Offset Length Contents
     00h     4       EDI
     04h     4       ESI
     08h     4       EBP
     0ch     4       reserved, ignored
     10h     4       EBX
     14h     4       EDX
     18h     4       ECX
     1ch     4       EAX
     20h     2       CPU status flags
     22h     2       ES
     24h     2       DS
     26h     2       FS
     28h     2       GS
     2ah     2       IP
     2ch     2       CS
     2eh     2       SP
     30h     2       SS
Out:
   if successful:
     carry flag clear
     ES:EDI = selector offset of modified real mode register
              data structure
   if failed:
     carry flag set
Notes:
The CS:IP in the real mode register data structure specifies the address of the real mode procedure to call.

If the SS:SP fields in the real mode register data structure are zero, a real mode stack will be provided by the host. Otherwise the real mode SS:SP will be set to the specified values before the procedure is called.

The flags specified in the real mode register data structure will be put on the real mode procedure's IRET frame. The procedure will be called with the interrupt and trace flags clear.

Values placed in the segment register positions of the data structure must be valid for real mode. That is, the values must be paragraph addresses, not protected mode selectors.

The target real mode procedure must return with the stack in the same state as when it was called. This means that the real mode code may switch stacks while it is running, but must return on the same stack that it was called on and must return with an IRET or discard the flags from the stack with a RETF 2 and should not clear the stack of any parameters that were passed to it on the stack.

When this function returns, the real mode register data structure will contain the values that were returned by the real mode procedure. The CS:IP and SS:SP values will be unmodified in the data structure.

It is the caller's responsibility to remove any parameters that were pushed on the protected mode stack.


Previous: Function 0301 - Call Real Mode Procedure With Far Return Frame To the Table of Content Next: Function 0303 - Allocate Real Mode Callback Address
Function 0301 - Call Real Mode Procedure With Far Return Frame Table of Content Function 0303 - Allocate Real Mode Callback Address

- 7.2.23 -