Re: how to return? Let's see how good you are.

2020-08-15 Thread Binyamin Dissen
smetz3 :>> :>> :>> ________ :>> From: IBM Mainframe Assembler List on behalf of Tony Thigpen :>> Sent: Tuesday, August 11, 2020 1:57 PM :>> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU :>> Subject: how to return? :>>

Re: how to return? Let's see how good you are.

2020-08-15 Thread Steve Smith
Yes. BAL from 24-bit is a special case. In amode 31, it's fine. sas On Sat, Aug 15, 2020 at 1:30 PM Martin Trübner wrote: > > >> The "special" cases, especially when R14 is loaded up separatelyWould > you being reached by a BAL consider a special case? L > 15,whereverI.e. BAL

Re: how to return? Let's see how good you are.

2020-08-15 Thread Martin Trübner
cht Von: Steve Smith Datum: 15.08.20 18:43 (GMT+01:00) An: ASSEMBLER-LIST@LISTSERV.UGA.EDU Betreff: Re: how to return? Let's see how good you are. Given those requirements, the only thing your subroutine needs to do isreturn with BSM 0,R14.  It will do the right thing in every cas

Re: how to return? Let's see how good you are.

2020-08-15 Thread Steve Smith
Given those requirements, the only thing your subroutine needs to do is return with BSM 0,R14. It will do the right thing in every case you mentioned. As you didn't originally specify much of this, we had to qualify answers with various unlikely scenarios. Fact is, BSM 0,R14 works correctly for

Re: how to return? Let's see how good you are.

2020-08-15 Thread Martin Truebner
Tony, >> 14) And to make it even more challenging, the code *must* run in a older >> processor that does not support branch-retaliative nor BAKR/PR >> instructions. Where would someone find such a processor? Facts are: 1.) BAKR/PR are around for very long time. 2.) The stack needs an

Re: how to return? Let's see how good you are.

2020-08-15 Thread Bernd Oppolzer
I didn't follow the whole discussion, but I now got interested because of the challenge and then I looked (again) at the original solution. IMO, the original solution is very elegant and solves the problem. I don't see any problem with it. In contrast, at a former customer of mine, where we

Re: how to return? Let's see how good you are.

2020-08-14 Thread Tony Thigpen
on.gmu.edu/~smetz3 From: IBM Mainframe Assembler List on behalf of Tony Thigpen Sent: Friday, August 14, 2020 6:23 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Let's see how good you are. I have been reading all the "that is

Re: how to return? Let's see how good you are.

2020-08-14 Thread Seymour J Metz
6:23 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Let's see how good you are. I have been reading all the "that is not a good way to do it" posts, so here it the challenge to all those nay-sayers. It's time to 'put-up' or 'shut-up'. Under the following conditions

Re: how to return? Let's see how good you are.

2020-08-14 Thread Tony Thigpen
MBLER-LIST@LISTSERV.UGA.EDU Subject: how to return? I came across the following code today. The program can either be called by JCL or from either an HLL or assembler program. While I included some extra code for clarity, the code I am asking for comments on is the code that 'fixes' R14 so that

Re: how to return?

2020-08-14 Thread Seymour J Metz
Simpler is safer. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Assembler List on behalf of Tony Thigpen Sent: Tuesday, August 11, 2020 1:57 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: how to return? I came across

Re: how to return?

2020-08-14 Thread Seymour J Metz
:33 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Too clever by far. Offhand I don't think I would give it a passing grade in a code review. I can't immediately think of situations where it might fail, but I have the sneaking suspicion that what I don't know (and that's

Re: how to return?

2020-08-13 Thread Peter Relson
Summary: If you want to return in the AMODE of the caller: -- If you can be entered by BASSM, you must not BSM 14,0. -- If you cannot be entered by BASSM but could be entered by something other than a BASR-like instruction (including BALR in AMODE 24, LA/B and others), and don't want to run in

Re: how to return?

2020-08-12 Thread Gary Weinhold
Thanks; I was confused by some of the responses and re-responses. On 2020-08-12 5:34 p.m., Steve Smith wrote: The goal should be to return to the caller in its amode, as that's undoubtedly what it expects. If a program is invoked via BASSM (or BSM), the amode in effect at entry is NOT the

Re: how to return?

2020-08-12 Thread Steve Smith
The goal should be to return to the caller in its amode, as that's undoubtedly what it expects. If a program is invoked via BASSM (or BSM), the amode in effect at entry is NOT the caller's amode, other than by chance. So if you save the amode at your entry, and use that for return, you will

Re: how to return?

2020-08-12 Thread Gary Weinhold
That was my point; If the goal is to allow the called program to switch to amode 31 and return to the caller in the amode it was in, it appears Binjamin's 2 instructions are sufficient.  The original code is checking to see if they need to do this (and there is a small exposure because the

Re: how to return?

2020-08-12 Thread Steve Smith
Absolutely not. Binyamin qualified his answer with "... where the mode you wish to return in is the same at entry to the routine." When called by BASSM, that is not the case. The OP's code was to solve a particular problem with a particular program. Nothing about it should be taken as good for

Re: how to return?

2020-08-12 Thread Martin Truebner
Gary, >> Are we to conclude from that this discussion that this is a reliable way >> to ensure that an AMODE 31 subroutine returns control to its caller >> in the correct amode? the code Tony had was to ensure that it can switch to whatever mode a routine to be called from that code needs

Re: how to return?

2020-08-12 Thread Gary Weinhold
Are we to conclude from that this discussion that this is a reliable way to ensure that an AMODE 31 subroutine returns control to its caller in the correct amode? From Binjamin's response, it appears that checking the opcode of the previous instruction was unnecessary and perhaps, depending on

Re: how to return?

2020-08-12 Thread Tony Thigpen
I talked to the author of the code. 1) The original program that this code was coded within actually was a glue phase that replaced a vendor provided phase that was always called using an api macro provided by the vendor to the customer. 2) At one point, the vendor was 24bit, but later

Re: how to return?

2020-08-12 Thread Martin Truebner
Uops Binjamin, I see my error -- Martin

Re: how to return?

2020-08-12 Thread Binyamin Dissen
On Wed, 12 Aug 2020 11:15:38 +0200 Martin Truebner wrote: :>Binjamin, :>your sequence :> LA14,0(,14) Fix-up address (in case 24 bit) :> BSM 14,0 Now BSM 0,14 will restore the current amode :>Will clear the amode-bit and BSM will set to that mode (0=24) and go :>there. I would

Re: how to return?

2020-08-12 Thread Martin Truebner
Binjamin, your sequence LA14,0(,14) Fix-up address (in case 24 bit) BSM 14,0 Now BSM 0,14 will restore the current amode Will clear the amode-bit and BSM will set to that mode (0=24) and go there. If you are very lucky you are never called in 31 bit mode then the code will

Re: how to return?

2020-08-12 Thread Binyamin Dissen
Looking more at the description of the problem, you want to use BSM to return no matter how called, where the mode you wish to return in is the same at entry to the routine. The following sequence will do it much more easily: LA14,0(,14) Fix-up address (in case 24 bit

Re: how to return?

2020-08-11 Thread Charles Mills
ay, August 11, 2020 3:42 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Suppose the return address is loaded into R14 instead of a link type instruction and R14 points to the first byte of a page In addition, when a program is attached, R14 usually points to CVTE

Re: how to return?

2020-08-11 Thread Keith Moe
day, August 11, 2020 11:33 AM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Too clever by far.  Offhand I don't think I would give it a passing grade in a code review. I can't immediately think of situations where it might fail, but I have the sneaking suspicion that what I don't k

Re: how to return?

2020-08-11 Thread Charles Mills
Re: how to return? Too clever by far. Offhand I don't think I would give it a passing grade in a code review. I can't immediately think of situations where it might fail, but I have the sneaking suspicion that what I don't know (and that's a lot) could bite that code. Peter -Original Mess

Re: how to return?

2020-08-11 Thread Gord Tomlin
On 2020-08-11 13:57, Tony Thigpen wrote: code that 'fixes' R14 Personally, I'm not a fan of that. I want to see the caller's actual R14. > CLI 0(R14),X'0C'BASSM? > BER14_OK > CLI 0(R14),X'0D'BSM? > BER14_OK The program

Re: how to return?

2020-08-11 Thread John McKown
On Tue, Aug 11, 2020 at 12:57 PM Tony Thigpen wrote: > I came across the following code today. The program can either be called > by JCL or from either an HLL or assembler program. While I included some > extra code for clarity, the code I am asking for comments on is the code > that 'fixes' R14

Re: how to return?

2020-08-11 Thread Binyamin Dissen
Well, if you are sure that you know the callers that the only choice is BASSM, BSM() or BA(L/S)R I would suggest making a standard of how the routine is called. Have you considered the effect of being invoked via BALR in 24 bit mode? On Tue, 11 Aug 2020 13:57:23 -0400 Tony Thigpen wrote:

Re: how to return?

2020-08-11 Thread Martin Truebner
Tony, what is done is this: was I reached by code that saved the callers mode (and passed in my mode) the it is safe to return with a BSM otherwise... I save the callers mode and later return to that (I is the pgm...) Apparently the code intents to switch mode (likely to be 24 to 31)

Re: how to return?

2020-08-11 Thread Farley, Peter x23353
: IBM Mainframe Assembler List On Behalf Of Ed Jaffe Sent: Tuesday, August 11, 2020 2:15 PM To: ASSEMBLER-LIST@LISTSERV.UGA.EDU Subject: Re: how to return? Clever... On 8/11/2020 10:57 AM, Tony Thigpen wrote: > I came across the following code today. The program can either be > called

Re: how to return?

2020-08-11 Thread Ed Jaffe
Clever... On 8/11/2020 10:57 AM, Tony Thigpen wrote: I came across the following code today. The program can either be called by JCL or from either an HLL or assembler program. While I included some extra code for clarity, the code I am asking for comments on is the code that 'fixes' R14 so

how to return?

2020-08-11 Thread Tony Thigpen
I came across the following code today. The program can either be called by JCL or from either an HLL or assembler program. While I included some extra code for clarity, the code I am asking for comments on is the code that 'fixes' R14 so that a BSM can be used instead of a BR. I just thought