Providing a Save Area
If one of your programs passes control to another, then the former must provide a save area where the contents of its registers are saved by the program it calls. A register save area is 18 fullwords long, beginning on a fullword boundary. The following table describes the save area's structure and content.
| Word | Contents |
|---|---|
| 0 | Used by PL/I, if applicable. Otherwise, unused. |
| 1 | If applicable, the address of the calling program's register save area. |
| 2 | The address of the current program's next register save area. |
| 3 | The contents of register 14 (the return address within the calling program). |
| 4 | The contents of register 15 (the address of the called program). |
| 5 | The contents of register 0. |
| 6 | The contents of register 1. |
| 7 | The contents of register 2. |
| 8 | The contents of register 3. |
| 9 | The contents of register 4. |
| 10 | The contents of register 5. |
| 11 | The contents of register 6. |
| 12 | The contents of register 7. |
| 13 | The contents of register 8. |
| 14 | The contents of register 9. |
| 15 | The contents of register 10. |
| 16 | The contents of register 11. |
| 17 | The contents of register 12. |
A called program can save the registers belonging to the program
that called it by issuing either the STM (STORE MULTIPLE) assembler
instruction or the SAVE macro. The
STM 14,12,12(13) assembler
instruction places the contents of all registers, except register
13, in the proper words of the save area. The SAVE macro is described
in detail in the entry titled SAVE.