delorie.com/djgpp/doc/dpmi/api/310302.html
|
search
|
Int 31H Function 0302H
Call Real Mode Procedure With IRET Frame
Simulates a FAR CALL with flags pushed on the stack to a real mode
procedure. The real mode routine must return by executing an IRET
instruction.
Call With
AX = 0302H
BH = flags
Bit | Significance |
0 | reserved for historical reason, must be zero |
1-7 | reserved, must be zero |
CX = number of words to copy from protected mode to
real mode stack
ES:(E)DI = selector:offset of real mode register data
structure in the following format:
Offset | Length | Contents |
00H | 4 | DI or EDI |
04H | 4 | SI or ESI |
08H | 4 | BP or EBP |
0CH | 4 | reserved, ignored |
10H | 4 | BX or EBX |
14H | 4 | DX or EDX |
18H | 4 | CX or ECX |
1CH | 4 | AX or 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 |
Returns
if function successful
Carry flag = clear
ES:(E)DI = selector:offset of modified real mode register
data structure
if function unsuccessful
Carry flag = set
AX = error code
8012H | linear memory unavailable (stack) |
8013H | physical memory unavailable (stack) |
8014H | backing store unavailable (stack) |
8021H | invalid value (CX too large) |
Notes
- 32-bit programs must use ES:EDI to point to the real mode register
data structure. 16-bit programs should use ES:DI.
- 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 DPMI host. Otherwise,
the real mode SS:SP will be set to the specified values before the
interrupt handler is called.
- The flags specified in the real mode register data structure will
be pushed on the real mode stack'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; i.e. the values must be
paragraph addresses and not selectors.
- All general register fields in the data structure are DWORDs so
that 32-bit registers can be passed to real mode. Note, however, that
16-bit hosts are not required to pass the high word of 32-bit general
registers or the FS and GS segment registers to real mode even when
running on an 80386 or later CPU.
- The target real mode handler or 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).
- When this function returns, the real mode register data structure
will contain the values that were returned by the real mode
procedure.
- It is the caller's responsibility to remove any parameters that
were pushed on the protected mode stack.