INT 31H 0303H: Allocate Real-mode Callback Address
Compatibility: DPMI 0.9+
Expects: AX 0303H
DS:SI (or DS:ESI) sel:off of protected-mode procedure to call
ES:DI (or DS:ESI) sel:off of buffer to hold a DpmiRegRec structure
Returns: CF NC (clear) if successful; else AX = DPMI Error Code
CX:DX segment:offset of real-mode callback
Info: This obtains a segment:offset address that may be used by real-
mode programs to execute a protected-mode procedure.
This provides a means for real-mode programs, such as device
drivers, interrupt handlers, or TSRs, to access services supplied
by a protected-mode program or to notify that program of events
which occur in real mode.
The DPMI client uses this fn to obtain an address, then uses some
other mechanism to pass that address to real-mode programs.
Then, when the real-mode program call that address, the DPMI host
fills the DpmiRegRec with the current registers, switches to
protected mode, and then calls the protected mode procedure.
DS:SI (or DS:ESI, when in 32-bit mode) is the address of a protected-
mode procedure. It must return via an IRET, with the data in the
DpmiRegRec at ES:(E)DI containing any return information and the
correct CS:IP to resume control must be in the structure. That
means you've got to dig through the stack in order to prepare for
ES:DI (or ES:EDI, when in 32-bit mode) points to a DpmiRegRec
structure. It may be empty when you use this fn. The DPMI host
fills it with data (as passed from the real-mode app) when it
performs the callback.
It is important to note that the segment values that will appear
in the structure are real-mode segments, not protected mode
Note: There is a limited number of these callbacks available per client
(but at least 16). Be sure to use INT 31H 0304H (free real-mode
callback address) when you no longer need it.
See Also: DPMI API
INT 2fH: Multiplex Interrupt