This entry linkage is reentrant and saves the caller's
registers, allocates a save area and dynamic storage, and establishes
program and dynamic storage base registers. This entry linkage
is paired with the return linkage that is located at the end
of the executable program; see
Reentrant return linkage.
For an example of nonreentrant entry and return linkage, see
Example of nonreentrant entry linkage—AMODE 31.
TITLE 'Alphabetical syscall of z/OS UNIX callable services'
BPXB1SM1 CSECT , Reentrant entry linkage
BPXB1SM1 AMODE 31
BPXB1SM1 RMODE ANY
USING *,R15 Program addressability
@ENTRY0 B @ENTRY1 Branch around program header
DROP R15 R15 not needed for addressability
DC C'BPXB1SM1 - Reentrant callable service examples'
DS 0H Ensure half word boundary
@ENTRY1 STM R14,R12,12(R13) Save caller's registers
LR R2,R13 Hold address of caller's area
LR R3,R1 Hold parameter register
LR R12,R15 R12 program base register
LA R11,2048(,R12) Second program base register
LA R11,2048(,R11) Second program base register
LA R9,2048(,R11) Third program base register
LA R9,2048(,R9) Third program base register
LA R4,2048(,R9) Fourth program base register
LA R4,2048(,R4) Fourth program base register
LA R7,2048(,R4) Fifth program base register
LA R7,2048(,R7) Fifth program base register
USING @ENTRY0,R12,R11,R9,R4,R7 Program addressability
L R0,@SIZEDAT Size this program's getmain area
GETMAIN RU,LV=(0) Getmain storage
LR R13,R1 R13 -> this program's save area
LA R10,2048(,R13) Second getmain base register
LA R10,2048(,R10) Second getmain base register
LA R6,2048(,R10) Third getmain base register
LA R6,2048(,R6) Third getmain base register
USING @STORE,R13,R10,R6 Getmain addressability
ST R2,@BACK Save caller's save area pointer
ST R13,8(,R2) Give caller our save area
LR R1,R3 Restore parameter register
@ENTRY2 EQU * * * * * * * End of the entry linkage code
SPACE ,
PSEUDO EQU * Dummy label used throughout