On Tue, 21 Sep 2010 10:57:09 -0400, Justin R. Bendich wrote:

>On Mon, 2 Aug 2010 15:34:00 -0600, Steve Comstock wrote:
>
>>[...] Peter Relson
>
>Now quoting from the latest Assembler Services Guide, page 13
>(Chapter 2)
>
>   Example of F5SA
>[...]
>   * Begin exit code
>            LGR   1,13                        Copy my savearea address
>            LMH   2,14,SAVF5SAG64HS2-SAVF5SA(13)
>   * Restore high halves
>            LG    13,SAVF5SAPREV-SAVF5SA(,13)
>   * Restore caller’s savearea address
>            FREEMAIN RU,A=(1),LV=SAVF5SA_LEN  Free my reentrant savearea
>            SLR   15,15                       Set return code of zero
>            L     14,SAVGRS14-SAVER(,13)      Restore caller’s R14
>            LM    2,12,SAVGRS2-SAVER(13)      Restore caller’s R2-R12
>            BR    14                          Return to caller
>
>The documentation for FREEMAIN does not say that the SVC has any
>obligation to preserve the high half of R14.
>
>In general, programs are required to preserve the high half of R14,
>but the FREEMAIN documentation specifically states that register 14
>is used as a work register by the system. Therefore, it shouldn't
>be obliged to preserve its high half, right?
>

I had asked Peter a similar question about GETMAIN.  My question
and his answer follows.

Question: I have another question about the example of using F5SA
and F8SA. The documentation of GETMAIN says that it uses register
14 as a work area. Because of this, shouldn’t the high half of
reg 14 be saved prior to the GETMAIN in the same way that
registers 0, 1 and 15 are saved?

Answer: GETMAIN won’t clobber the high half of reg 14. Only the
low half (which matches the linkage standard whereby a routine
does not clobber high halves of regs 2-14). Otherwise, you’re
certainly right that it would be necessary to preserve that half
of reg 14 before calling GETMAIN.

--
Tom Marchant

Reply via email to