To change addressing mode you must change the value of the PSW
A-mode bit. The following list includes all the ways to change addressing
mode.
- The mode setting instructions BASSM and BSM.
- Macros (ATTACH, ATTACHX, LINK, LINKX, XCTL, or XCTLX). The system
makes sure that routines get control in the specified addressing mode.
Users need only ensure that parameter requirements are met. MVS™ restores
the invoker's mode on return from LINK or LINKX.
- SVCs. The supervisor saves and restores the issuer's addressing
mode and ensures that the service routine receives control in the
addressing mode specified in its SVC table entry.
- SYNCH or SYNCHX with the AMODE parameter to specify the addressing
mode in which the invoked routine is to get control.
- The CIRB macro and the stage 2 exit effector. The CIRB macro is
described in z/OS MVS Programming: Authorized Assembler Services Guide and z/OS MVS Programming: Authorized Assembler Services Reference ALE-DYN.
- A PC, PT, or PR instruction. These three instructions establish
the specified addressing mode.
- An LPSW instruction (not recommended).
The example in
Figure 1 illustrates how a
change in addressing mode in a 24-bit addressing mode program enables
the program to retrieve data from the ACTLB control block, which might
reside above 16 megabytes. The example works correctly whether or
not the control block is actually above 16 megabytes. The example
uses the BSM instruction to change addressing mode. In the example,
the instruction L 2,4(,15) must be executed in 31-bit addressing mode.
Mode setting code (BSM) before the instruction establishes 31-bit
addressing mode and code following the instruction establishes 24-bit
addressing mode.
Figure 1. Mode
Switching to Retrieve Data from Above 16 MegabytesUSER CSECT
USER RMODE 24
USER AMODE 24
L 15,ACTLB
L 1,LABEL1 SET HIGH-ORDER BIT OF REGISTER 1 TO 1
AND PUT ADDRESS INTO BITS 1-31
BSM 0,1 SET AMODE 31 (DOES NOT PRESERVE AMODE)
LABEL1 DC A(LABEL2 + X'80000000')
LABEL2 DS 0H
L 2,4(,15) OBTAIN DATA FROM ABOVE 16 MEGABYTES
LA 1,LABEL3 SET HIGH-ORDER BIT OF REGISTER 1 TO 0
AND PUT ADDRESS INTO BITS 1-31
BSM 0,1 SET AMODE 24 (DOES NOT PRESERVE AMODE)
LABEL3 DS 0H