User`s guide
Recommended and Required Source Changes
3.3 Flow Control Mechanisms
Rout1: .JSB_ENTRY
.
.
MOVAB Rout1_callback, R0
JSB rout2
RSB
Rout1_callback: .JSB_ENTRY
PUSHL R0 ; Push callback address received in R0
.
.
JSB @(SP)+ ; Callback to rout2
.
.
RSB
Rout2: .JSB_ENTRY
PUSHL R0 ; Push callback address received in R0
.
.
MOVAB Rout2_callback, R0
JSB @(SP)+ ; Callback to Rout1
RSB
Rout2_callback: .JSB_ENTRY
.
.
RSB
3.3.7 Using REI to Change Modes
A common VAX use of the REI instruction is to change modes by pushing an
explicit target PC and PSL on the stack. This code cannot be compiled without
some changes to the source code on OpenVMS Alpha or OpenVMS I64 systems
for the following reasons:
• The destination code on OpenVMS Alpha requires that a linkage section
pointer be established. The destination code on OpenVMS I64 requires that a
GP be established. REI does not provide a way to do these.
• An REI frame on an Integrity server is more complex than on an Alpha
or VAX system and includes saved general registers, other registers, and
information about the register stack. (Similarly, an REI frame on an Alpha
system is more complex than on a VAX system and includes saved registers.)
The prologue code on Itanium is required to establish a register frame.
In addition, on Itanium and Alpha, all subroutines have epilogue code to
restore saved, nonscratch registers. A new syntax would be necessary to
accommodate register passing and restoration.
• The mode change means that the process will be executing on a different
stack at the target. This places new requirements on cleaning up the
previous stack.
Recommended Change
A system routine, EXE$REI_INIT_STACK, has been created to perform the
corresponding function for OpenVMS Alpha or OpenVMS I64 systems. This
routine accepts the new mode and a callback routine address as parameters. This
routine has the advantage of being usable from higher-level languages as well.
You must restructure existing code so that this routine call can be used. The
code label where execution is to continue must be declared with an entry point
directive, since it will be called by the system routine.
Recommended and Required Source Changes 3–13