If starting in AMODE 64
An AMODE 64 program must specify SYSSTATE AMODE64=YES.
When it receives control, the target program saves the 64-bit GPRs into the 144-byte (or larger) doubleword-aligned caller-provided save area pointed to by 64-bit GPR 13. The format of this area is shown in Figure 1. As indicated by this figure, the contents of each GPR, except GPR 13, must be saved in a specific location within the save area. GPR 13 is not saved into the save area; it holds the address of the save area.
- Word
- Contents
- 0
- Used by language products.
- 1
- Value of "F4SA". "F4SA", stored by a program in its save area, indicates how the program has saved the calling program's registers, in this case saving the 64-bit GPRs in the caller-provided save area whose address is in words 32-33 of this save area.
- 2 - 3
- 64-bit GPR 14 (return address).
- 4 - 5
- 64-bit GPR 15.
- 6 - 31
- 64-bit GPRs 0 - 12.
- 32 - 33
- Address of previous save area (stored by a program in its save area).
- 34 - 35
- Address of next save area (stored by target program within caller's save area).
STMG 14,12,8(13)
PROGNAME SAVE (14,12)
Later, the program can use the RETURN macro (or the load-multiple (LMG) instruction) to restore 64-bit GPRs and return to the caller. Similar to the note for SAVE, a program that is using F4SA format but is not AMODE 64 should not use the RETURN macro.
- Stores the address of the calling program's save area (the address passed in 64-bit GPR 13) into words 32 and 33 of its own save area.
- Stores the address of its own save area (the address the target program will place into 64-bit GPR 13) into words 34 and 35 of the calling program's save area.
- Saves the string "F4SA" into the 2nd word of its own save area. "F4SA" indicates how the target program has saved the calling program's registers, in this case saving the 64-bit GPRs in the caller-provided save area whose address is in words 32-33 of this save area.
If you choose not to use the SAVE and RETURN macros, you can use the IHASAVER macro to map the fields in the save area.