Using BAL/BALR with AMODE ANY Programs
Programs can be designed to be insensitive to the addressing mode in which they receive control. These programs are referred to as AMODE ANY programs and are designed to execute in the AMODE of the caller. You can use the BALR/BAL and BR instructions to pass control to and from AMODE ANY programs.
In developing AMODE ANY programs, you should be aware of the following
considerations:
- Certain machine instructions (BAL, BALR, LA, TRT, EDMK) execute
differently depending on the addressing mode in effect when they are
invoked. AMODE ANY programs must not have any dependency on the mode-dependent
manner in which these instructions execute. For example, the BAL and
BALR instructions save the instruction length code, the condition
code, and the program mask in bits 0 - 7 of the link register in 24-bit
addressing mode but not in 31-bit addressing mode. If this information
is required by the application, you can use the IPM (Insert Program
Mask) instruction instead because it operates identically in 24-bit
and 31-bit addressing modes.
For more information on the mode-sensitive behavior of these instructions, please see z/VM: ESA/XC Principles of Operation.
- Programs designed to operate in this manner need to consider proper program residency (RMODE) requirements. In particular, a program executing in 24-bit addressing mode cannot branch to an AMODE ANY program which resides above the 16MB line.