If the caller has provided a 144-byte (or larger) save
area, then the protocol described for AMODE 64 programs can be used.
If the caller has provided a 72-byte save area, then the target
program must save the low halves of the 64-bit GPRs in that 72-byte
area, and then must save the high halves in its own Format 5 or Format
8 save area. The format of the Format 5 area is shown in Figure 1 and the format of the Format 8 area
is shown in Figure 2. As indicated by
the figures, 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.
Figure 1. Format of the
Format 5 save area (F5SA)- Word
- Contents
- 0
- Used by language products.
- 1
- Value of "F5SA". "F5SA", stored by a program in its save area,
indicates how the program has saved the calling program's registers,
in this case partly in the caller-provided save area and partly in
this save area. Bits 32-63 of the 64-bit GPRs were saved in the caller-provided
save area whose address is in words 32-33 of this save area, and bits
0-31 of the 64-bit GPRs were saved in words 36-51 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).
- 36 - 51
- High halves of the caller's GPRs 0 - 15.
- 52 - 53
- Undefined.
Figure 2. Format of the
Format 8 save area (F8SA)- Word
- Contents
- 0
- Used by language products.
- 1
- Value of "F8SA". "F8SA" stored by a program in its save area,
indicates how the program has saved the calling program's registers,
in this case partly in the caller-provided save area and partly in
this save area Bits 32-63 of the 64-bit GPRs were saved in the caller-provided
save area whose address is in words 32-33 of this save area, and bits
0-31 of the 64-bit GPRs were saved in words 54-69 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).
- 36 - 51
- ARs 14, 15, 0-13.
- 52 - 53
- Undefined.
- 54 - 69
- High halves of the caller's GPRs 0 - 15.
- 70 - 71
- Undefined.
The target program
must create its own save area. It:
- Stores the low halves of the calling program's GPRs into the calling
program's save area (the address passed in GPR 13).
- Creates its own 216-byte save area (if using F5SA) or 288-byte
save area (if using F8SA), taking care to preserve the values of the
high halves of any of the calling program's GPRs
- Stores the address of the calling program's save area (the address
passed in GPR 13) into words 32 and 33 of its own save area.
- Stores the address of its own save area into the 3rd word of the
calling program's save area if the target program's own save area
is below 2G.
- Saves the string "F5SA" (if using F5SA) or the string "F8SA" (if
using F8SA) into the 2nd word of its own save area.. "F5SA" or "F8SA"
indicates how the target program has saved the calling program's registers,
in this case saving bits 32-63 of the 64-bit GPRs in the caller-provided
save area whose address is in words 32-33 of this save area, and bits
0-31 of the 64-bit GPRs in words 36-51 (for "F5SA") or 54-69 (for
"F8SA") of this save area.
Note: The F8SA area is exactly like the
F5SA area except for the identification string saved into the second
word and the fact that the F8SA area provides space into which a program
called by the creator of the save area can save both ARs and 64-bit
GPRs whereas the F5SA area provides space only for the 64-bit GPRs.
These steps enable the target program to find the calling program's
save area when it needs it to restore the caller's registers, and
they enable a trace backward from the most recent save area to previous
save areas should one be necessary while examining a dump.