I am not aware of any documented XPLINK assembler examples, and as I'm
retired from IBM I no longer have access to any mainframe environment, so I
can't look for samples there.

An example would certainly be helpful, but having written HLASM code for
Linux (using the relevant Application Binary Interface document), I feel
it's fairly clear what would be needed.

>From my own quick look at the documentation, including linked additional
information:

I would presume you define variables using a DSECT as usual, based on the
stack register R4 (but with an offset of 2048), starting user variables
after reserving fields for the standard part.

"Preserved" means that the caller can rely on the value being unchanged
across a call.  Registers R8-R15 are saved and restored.  Note that the
entry register is a convention which is not guaranteed to be used - if the
routine is called using a register, it will be set, but if it is for example
called using a relative branch it may not be set.  And although the return
address is in R7 on entry, the caller cannot assume that it is necessarily
still pointing to the return location after the call.  So of registers R0 to
R7, only R4 (stack pointer) is going to be the same after a call, and that's
only because of the way the stack pointer is decremented and incremented,
not because it is saved and restored.

It is of course a very different environment from the usual z/OS linkage
environment.

For more clues, I would simply suggest looking at the code generated for a
non-trivial C function compiled with XPLINK.

Jonathan Scott

-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On
Behalf Of Charles Mills
Sent: 21 April 2025 19:43
To: [email protected]
Subject: Re: XPLINK register conventions for called HLASM?

Jonathon, yes there is a lot in the LE PG. But it's not really what you
would want if you were writing a program.

Yes, the stack frame layout is documented. But how do I define variables in
the DSA? How do I address it?

Yes, the register "conventions" are "documented." What does "preserved"
mean? Does that mean that I am supposed to preserve it?

I think it is classic documentation in that if you already know the answers,
then yup, sure enough, you can prove that the answer is right there on page
487. But if you are trying to learn to use it for the first time then -- at
least in my reading -- it is a jumble of random facts. 

Or perhaps I asked the wrong question. Let me rephrase my question: Can you
recommend a tutorial on writing a C++ XPLINK subroutine in HLASM? (And if
not, then how DOES IBM expect customers to do so?)

Charles

Reply via email to