is there any documentation on using the new 64 bit instructions?

2022-06-29 Thread Colin Paice
Thanks for all of the comments.  I had some offline as well as online.

I found John R. Ehrman's book very interesting, a bit of bedtime reading.

I called my code using #PRAGMA LINKAGE(xxx,OS), and did not need to worry
about XPLINK.

Because the z/OS routines I was using are 31 bit, I needed to get storage
it could address so, I in my 64 bit program, I used

char * __ptr32 Data =   (char *) __malloc31(1024);

My question about needing BSM is due to C using BALR to branch to code!
I'll blog some of my lessons learned.

I've managed to run Python as a started task, and respond to the
operatorSTOP and modify requests,  for example "F PYTHJOB,'my data'"

If anyone is interested in this, please contact me offline.

I'll investigate the use of C - and David Crayford's __ASM__solution -
thank you.

Colin

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread David Crayford

Fixed the typo!

__asm__(
  " LLGT 15,%[ep]\n"
  " LR 1,%[PARMS]\n"
  " LR 13,%[savearea]\n"
  " SAM31\n"
  " BALR 14,15\n"
  " SAM64\n"
  " ST 15,%[rc]\n"
  : [rc]"=m"(rc)
  : [ep]"m"(ep), [savearea]"r"(>savearea), 
[parms]"r"(>parms)

  : "r0", "r1", "r13", "r14", "r15"
);

On 29/06/2022 10:14 am, David Crayford wrote:
You need to use inline assembly with SAM31/SAM64 AMODE switching. All 
of our stuff is 64-bit so we do this a lot. Don't forget to allocate 
the savearea and parmlist/parms below the bar.


__asm__(
  " LLGT 15,%[ep]\n"
  " LR 1,%[PARMS]\n"
  " LR 13,%[savearea]\n"
  " SAM31\n"
  " BALR 14,15\n"
  " SAM64\n"
  " ST 15,%[rc]\n"
  : [rc]"=m"(rc)
  : [ep]"m"(ep), [savearea]"r"(>savearea), 
[parms]"r"(>parms)

  : "r0", "r1", "r13", "r14", "r15"
);

On 28/06/2022 10:12 pm, Colin Paice wrote:
I've been working on calling an (amode 31) assembler program from a 
64 bit
C program, and have been struggling.Is there is a good guide on how 
to use

these new instructions?
For example
1)
I've found you need to use a  LLGTR R1... instruction to clear the 
register

before using a L R1... because without it the high part of the register
will have some 64 bit rubbish in it

2)
I used

BAKR  R14,0
PR
But it kept returning in amode 24 bit mode.  It needs BSM 14,0  before
the  BAKR.__

The POP tells you all about the instructions - but not how to use 
it.  The

z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
completely trustworthy.
_
Is there a better place to ask?

Colin

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread David Crayford
You need to use inline assembly with SAM31/SAM64 AMODE switching. All of 
our stuff is 64-bit so we do this a lot. Don't forget to allocate the 
savearea and parmlist/parms below the bar.


__asm__(
  " LLGT 15,%[ep]\n"
  " LR 1,%[PARMS]\n"
  " LR 13,%[savearea]\n"
  " SAM31\n"
  " BALR 14,15\n"
  " SAM64\n"
  " ST 15,%[rc]\n"
  : [rc]"=m"(rc)
  : {ep"m"(ep), [savearea]"r"(>savearea), [parms]"r"(>parms)
  : "r0", "r1", "r13", "r14", "r15"
);

On 28/06/2022 10:12 pm, Colin Paice wrote:

I've been working on calling an (amode 31) assembler program from a 64 bit
C program, and have been struggling.Is there is a good guide on how to use
these new instructions?
For example
1)
I've found you need to use a  LLGTR R1... instruction to clear the register
before using a L R1... because without it the high part of the register
will have some 64 bit rubbish in it

2)
I used

BAKR  R14,0
PR
But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
the  BAKR.__

The POP tells you all about the instructions - but not how to use it.  The
z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
completely trustworthy.
_
Is there a better place to ask?

Colin

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Joe Monk
Hello...

The link says:

"All AMODE 31 programs that are involved in the interoperability scenario
need to be non-XPLINK. All AMODE 31 and AMODE 64 programs that are involved
in the interoperability scenario need to be reentrant."

Joe

On Tue, Jun 28, 2022 at 2:59 PM Denis <
01664d8ede6c-dmarc-requ...@listserv.ua.edu> wrote:

> Hi Joe,
> you should have a look at LE 31/64 bit interoperability:
>
> https://www.ibm.com/docs/en/zos/2.4.0?topic=interoperability-introduction-amode-31-amode-64-programs
> Denis.
>
> -Original Message-
> From: Joe Monk 
> To: IBM-MAIN@LISTSERV.UA.EDU
> Sent: Tue, Jun 28, 2022 7:33 pm
> Subject: Re: is there any documentation on using the new 64 bit
> instructions?
>
> If youre using LE, you can't mix 31 and 64 bit, because 64-bit C using LE
> uses a 64-bit XPLINK which passes parameters from the stack above the bar.
>
> I think you will have to write a glue assembler module to receive control
> in AMODE 64 then SAM31 CALL  SAM64 and back.
>
> Joe
>
>
>
> On Tue, Jun 28, 2022 at 9:13 AM Colin Paice  wrote:
>
> > I've been working on calling an (amode 31) assembler program from a 64
> bit
> > C program, and have been struggling.Is there is a good guide on how to
> use
> > these new instructions?
> > For example
> > 1)
> > I've found you need to use a  LLGTR R1... instruction to clear the
> register
> > before using a L R1... because without it the high part of the register
> > will have some 64 bit rubbish in it
> >
> > 2)
> > I used
> >
> > BAKR  R14,0
> > PR
> > But it kept returning in amode 24 bit mode.  It needs BSM  14,0  before
> > the  BAKR.__
> >
> > The POP tells you all about the instructions - but not how to use it.
> The
> > z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
> > completely trustworthy.
> > _
> > Is there a better place to ask?
> >
> > Colin
> >
> > --
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
> >
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Denis
Hi Joe,
you should have a look at LE 31/64 bit interoperability:
https://www.ibm.com/docs/en/zos/2.4.0?topic=interoperability-introduction-amode-31-amode-64-programs
Denis.

-Original Message-
From: Joe Monk 
To: IBM-MAIN@LISTSERV.UA.EDU
Sent: Tue, Jun 28, 2022 7:33 pm
Subject: Re: is there any documentation on using the new 64 bit instructions?

If youre using LE, you can't mix 31 and 64 bit, because 64-bit C using LE
uses a 64-bit XPLINK which passes parameters from the stack above the bar.

I think you will have to write a glue assembler module to receive control
in AMODE 64 then SAM31 CALL  SAM64 and back.

Joe



On Tue, Jun 28, 2022 at 9:13 AM Colin Paice  wrote:

> I've been working on calling an (amode 31) assembler program from a 64 bit
> C program, and have been struggling.Is there is a good guide on how to use
> these new instructions?
> For example
> 1)
> I've found you need to use a  LLGTR R1... instruction to clear the register
> before using a L R1... because without it the high part of the register
> will have some 64 bit rubbish in it
>
> 2)
> I used
>
> BAKR  R14,0
> PR
> But it kept returning in amode 24 bit mode.  It needs BSM  14,0  before
> the  BAKR.__
>
> The POP tells you all about the instructions - but not how to use it.  The
> z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
> completely trustworthy.
> _
> Is there a better place to ask?
>
> Colin
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Charles Mills
I have no experience with this specifically (I do have lots of 31-bit C/HLASM 
experience) but if you are writing the HLASM from scratch, or re-writing it 
somewhat anyway, I would think the easiest thing would be just to write the 
HLASM to be 64-bit.

I found the thought of 64-bit to be scary but the reality was not too bad. (One 
of my called routines switches back and forth because it references 
above-the-bar storage.) Yes, those high halves will get you again and again. 
Yes, LLGTR and LLGT are your friends. I kind of got into the habit of just 
thinking of them as "my load instructions." I checked with Dr. Shum and he said 
there was no performance penalty relative to "normal" loads. 

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Joe Monk
Sent: Tuesday, June 28, 2022 10:33 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: is there any documentation on using the new 64 bit instructions?

If youre using LE, you can't mix 31 and 64 bit, because 64-bit C using LE
uses a 64-bit XPLINK which passes parameters from the stack above the bar.

I think you will have to write a glue assembler module to receive control
in AMODE 64 then SAM31 CALL  SAM64 and back.

Joe



On Tue, Jun 28, 2022 at 9:13 AM Colin Paice  wrote:

> I've been working on calling an (amode 31) assembler program from a 64 bit
> C program, and have been struggling.Is there is a good guide on how to use
> these new instructions?
> For example
> 1)
> I've found you need to use a  LLGTR R1... instruction to clear the register
> before using a L R1... because without it the high part of the register
> will have some 64 bit rubbish in it
>
> 2)
> I used
>
> BAKR  R14,0
> PR
> But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
> the  BAKR.__
>
> The POP tells you all about the instructions - but not how to use it.  The
> z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
> completely trustworthy.
> _
> Is there a better place to ask?
>
> Colin
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Joe Monk
If youre using LE, you can't mix 31 and 64 bit, because 64-bit C using LE
uses a 64-bit XPLINK which passes parameters from the stack above the bar.

I think you will have to write a glue assembler module to receive control
in AMODE 64 then SAM31 CALL  SAM64 and back.

Joe



On Tue, Jun 28, 2022 at 9:13 AM Colin Paice  wrote:

> I've been working on calling an (amode 31) assembler program from a 64 bit
> C program, and have been struggling.Is there is a good guide on how to use
> these new instructions?
> For example
> 1)
> I've found you need to use a  LLGTR R1... instruction to clear the register
> before using a L R1... because without it the high part of the register
> will have some 64 bit rubbish in it
>
> 2)
> I used
>
> BAKR  R14,0
> PR
> But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
> the  BAKR.__
>
> The POP tells you all about the instructions - but not how to use it.  The
> z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
> completely trustworthy.
> _
> Is there a better place to ask?
>
> Colin
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Robin Vowels

Try John Ehrman's Assembly Language Programming

On 2022-06-29 00:12, Colin Paice wrote:
I've been working on calling an (amode 31) assembler program from a 64 
bit
C program, and have been struggling.Is there is a good guide on how to 
use

these new instructions?
For example
1)
I've found you need to use a  LLGTR R1... instruction to clear the 
register

before using a L R1... because without it the high part of the register
will have some 64 bit rubbish in it

2)
I used

BAKR  R14,0
PR
But it kept returning in amode 24 bit mode.  It needs BSM   14,0  
before

the  BAKR.__

The POP tells you all about the instructions - but not how to use it.  
The

z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
completely trustworthy.
_
Is there a better place to ask?

Colin


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Farley, Peter x23353
IBM Mainframe Assembler List 

Do you have z/XDC available for debugging?  Or better yet, c/XDC, which is Cole 
Software's C debugger?  One or both might be of tremendous help to you here.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Colin Paice
Sent: Tuesday, June 28, 2022 11:08 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: is there any documentation on using the new 64 bit instructions?

Peter,
I call my Assembler  program from C  using


*#pragma linkage(QEDIT   , OS)   rc = QEDIT( pParm ); *
and get round the XPLINK challenge.

I could not find an assembler list... please could you send details of this.  
It would have been my first port of call.

thank you

Colin

On Tue, 28 Jun 2022 at 15:47, Farley, Peter x23353 < 
031df298a9da-dmarc-requ...@listserv.ua.edu> wrote:

> Doesn't 64-bit C call your amode 31 program using the XPLINK interface?
> I'm not sure XPLINK has the right value in R14 for PR to set the 
> return mode correctly, but I confess I have done no practical work 
> with XPLINK, so I may be off base here.
>
> You could CC your question to the Assembler list as well, though I 
> think almost everyone who lurks there also lurks here.
>
> Peter
>
> -Original Message-
> From: IBM Mainframe Discussion List  On 
> Behalf Of Colin Paice
> Sent: Tuesday, June 28, 2022 10:13 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: is there any documentation on using the new 64 bit instructions?
>
> I've been working on calling an (amode 31) assembler program from a 64 
> bit C program, and have been struggling.Is there is a good guide on 
> how to use these new instructions?
> For example
> 1)
> I've found you need to use a  LLGTR R1... instruction to clear the 
> register before using a L R1... because without it the high part of 
> the register will have some 64 bit rubbish in it
>
> 2)
> I used
>
> BAKR  R14,0
> PR
> But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
> the  BAKR.__
>
> The POP tells you all about the instructions - but not how to use it.  
> The z/OS doc says use BACK/PR  without mentioning the  BSM, so this is 
> not completely trustworthy.
> _
> Is there a better place to ask?
>
> Colin
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Colin Paice
Peter,
I call my Assembler  program from C  using


*#pragma linkage(QEDIT   , OS)   rc = QEDIT( pParm ); *
and get round the XPLINK challenge.

I could not find an assembler list... please could you send details of
this.  It would have been my first port of call.

thank you

Colin

On Tue, 28 Jun 2022 at 15:47, Farley, Peter x23353 <
031df298a9da-dmarc-requ...@listserv.ua.edu> wrote:

> Doesn't 64-bit C call your amode 31 program using the XPLINK interface?
> I'm not sure XPLINK has the right value in R14 for PR to set the return
> mode correctly, but I confess I have done no practical work with XPLINK, so
> I may be off base here.
>
> You could CC your question to the Assembler list as well, though I think
> almost everyone who lurks there also lurks here.
>
> Peter
>
> -Original Message-
> From: IBM Mainframe Discussion List  On Behalf
> Of Colin Paice
> Sent: Tuesday, June 28, 2022 10:13 AM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: is there any documentation on using the new 64 bit instructions?
>
> I've been working on calling an (amode 31) assembler program from a 64 bit
> C program, and have been struggling.Is there is a good guide on how to use
> these new instructions?
> For example
> 1)
> I've found you need to use a  LLGTR R1... instruction to clear the
> register before using a L R1... because without it the high part of the
> register will have some 64 bit rubbish in it
>
> 2)
> I used
>
> BAKR  R14,0
> PR
> But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
> the  BAKR.__
>
> The POP tells you all about the instructions - but not how to use it.  The
> z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
> completely trustworthy.
> _
> Is there a better place to ask?
>
> Colin
> --
>
> This message and any attachments are intended only for the use of the
> addressee and may contain information that is privileged and confidential.
> If the reader of the message is not the intended recipient or an authorized
> representative of the intended recipient, you are hereby notified that any
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please notify us immediately by
> e-mail and delete the message and any attachments from your system.
>
>
> --
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Farley, Peter x23353
Doesn't 64-bit C call your amode 31 program using the XPLINK interface?  I'm 
not sure XPLINK has the right value in R14 for PR to set the return mode 
correctly, but I confess I have done no practical work with XPLINK, so I may be 
off base here.

You could CC your question to the Assembler list as well, though I think almost 
everyone who lurks there also lurks here.

Peter

-Original Message-
From: IBM Mainframe Discussion List  On Behalf Of 
Colin Paice
Sent: Tuesday, June 28, 2022 10:13 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: is there any documentation on using the new 64 bit instructions?

I've been working on calling an (amode 31) assembler program from a 64 bit C 
program, and have been struggling.Is there is a good guide on how to use these 
new instructions?
For example
1)
I've found you need to use a  LLGTR R1... instruction to clear the register 
before using a L R1... because without it the high part of the register will 
have some 64 bit rubbish in it

2)
I used

BAKR  R14,0
PR
But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
the  BAKR.__

The POP tells you all about the instructions - but not how to use it.  The z/OS 
doc says use BACK/PR  without mentioning the  BSM, so this is not completely 
trustworthy.
_
Is there a better place to ask?

Colin
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


is there any documentation on using the new 64 bit instructions?

2022-06-28 Thread Colin Paice
I've been working on calling an (amode 31) assembler program from a 64 bit
C program, and have been struggling.Is there is a good guide on how to use
these new instructions?
For example
1)
I've found you need to use a  LLGTR R1... instruction to clear the register
before using a L R1... because without it the high part of the register
will have some 64 bit rubbish in it

2)
I used

BAKR  R14,0
PR
But it kept returning in amode 24 bit mode.  It needs BSM   14,0  before
the  BAKR.__

The POP tells you all about the instructions - but not how to use it.  The
z/OS doc says use BACK/PR  without mentioning the  BSM, so this is not
completely trustworthy.
_
Is there a better place to ask?

Colin

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN