Well, this is the best and most accurate advice. However, the comments on the LLGTR are misleading. It is there to clear the high-order 33 bits, but only the high 32 are in question. LARL, like all LA* instructions clears bit 32 when in AMODE 31.

If this code was running AMODE 64 (and it's not magic, difficult, or dangerous), then the LLGTR would be entirely superfluous.

sas

On 8/9/2015 19:02, Peter Relson wrote:
The original post made no mention of what problem (if any was
encountered).

There is no need to LLGTR or OILL. The value returned from LOAD is
suitable for use by BASSM. Thus it has the low bit on when the module is
AMODE 64.

But the right thing to do after the load is to save the 64-bit GR0 not the
32-bit GR0. The LLGTR will be OK as long as the module is below 2G (it
does not clear bit 63), but someday the module might be above 2G. You
don't want to be clearing 33 bits of a 64-bit address.

When you want to call, assuming that you want to place the entry point
address in register 15, set 64-bit GR15 and issue BASSM 14,15.

But of course you'd better make sure that any data that that target
routine will rely on has also been set up properly (such as the high
halves of parameter list address and save area address). Thus (adding the
LLGTR for R1, and changing PROG64@ to be a doubleword and using LG)

LARL  R1,STRUCT31    31 Bit Structure
LLGTR R1,R1          Clear high bit in case it's an AMODE 64 target
LG    R15,PROG64@    Get 64-bit Target Routine Address from Load
BASSM R14,R15        Call PROG64 in whatever AMODE it is defined to be

Where PROG64@ is not "A" or even "2A" but "AD". It should be double-word
aligned for best processing.

Peter Relson
z/OS Core Technology Design

Reply via email to