Overview [ Switch Programming User's Guide ] MPE/iX 5.0 Documentation
Switch Programming User's Guide
Overview
This overview presents mixed-mode procedure calls in the CM --> NM
direction in two ways:
* Schematic flow-of-control diagram
* Stepwise sequence of events
Flow of Control: CM --> NM
The flow of control for mixed-mode procedure calls in the direction CM
--> NM is illustrated in Figure 4.1:
Figure 4.1. CM --> NM Switch Summary 1
Stepwise Switch to NM
A mixed-mode procedure call in the direction CM --> NM involves the
following steps, as indicated in Figure 4.1:
1. The CM code needing to access an NM routine calls
Switch, either by means of in-line code or a Switch
stub.
2. The in-line code or CM Switch stub sets up the data
structures and parameters required by Switch and makes a
call to either the HPSWTONMNAME intrinsic or the
HPLOADNMPROC and HPSWTONMPLABEL intrinsics.
3. HPSWTONMNAME or HPSWTONMPLABEL calls the NM routine,
after preparing the NM registers as though the call was
being made from Native Mode.
4. The NM routine executes as though called from Native
Mode and returns the functional return value (if any) to
the calling Switch intrinsic. Reference parameters are
modified by the NM routine.
5. If the NM routine has a functional return value,
HPSWTONMNAME or HPSWTONMPLABEL copies the value back to
the CM stack.
6. The stub or in-line code checks whether the Switch
operation was successful and then control returns to the
CM routine.
NOTE HPSWTONMNAME or a combination of HPLOADNMPROC and HPSWTONMPLABEL
are the system intrinsics called to pass CM values and parameters
to Native Mode, to change the execution mode, and to invoke an NM
routine. HPSWTONMNAME, HPLOADNMPROC, and HPSWTONMPLABEL reside in
the CM system library, SL.PUB.SYS. The only difference between
using HPSWTONMNAME and HPSWTONMPLABEL is the manner in which the
target routine is identified.
MPE/iX 5.0 Documentation