Am 21.10.2014 19:53, schrieb Don Poitras:
In article <caarmm9rskjgk-ypgufnhowtvkpbjbykdk0cr2i3vnnrrurx...@mail.gmail.com>
you wrote:
On 21 October 2014 10:09, Tom Marchant <
[email protected]> wrote:
I've never seen a case where "BALR is used to return to the caller."
Well... Here's the epilog code for a non-main function generated by an
oldish version of IBM C:
00010E Start of Epilog
00010E 58D0 D004 00413 | L r13,4(,r13)
000112 58E0 D00C 00413 | L r14,12(,r13)
000116 9824 D01C 00413 | LM r2,r4,28(r13)
00011A 051E 00413 | BALR r1,r14
00011C 0707 00413 | NOPR 7
00011E 0000
000120 Start of Literals
000120 0100018D =F'16777613'
000124 05000194 =F'83886484'
000128 0900019A =F'150995354'
00012C End of Literals
Why they use[d] BALR I don't know, but surely they don't plan to return to
the NOPR and the certain program check that follows. Perhaps the NOPR can
be changed to something else for debugging.
Tony H.
It's just a way to pass a parm to the library epilog routine. I would
guess that '7' just means 'normal epilog'. The library looks at what
R1+1 contains and makes various decisions based on the value.
I don't think that the BALR R1,R14 calls a "library epilog routine";
the BALR R1,R14 goes back to the caller, because the return address
to the caller (after the BALR R14,R15 etc.) has been loaded from the
save area. If this should make any sense, then the caller should check
R1 just after the call ... but that's normally what R15 is meant for
(return code or function result in C).
Debugging could be one reason for establishing such a return instruction
instead of a "normal" BR 14 ... it would be interesting to see the compiler
options of this old compile.
Kind regards
Bernd
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN