Re: XLC C/C++, __R1 and Register 0

2022-10-28 Thread David Crayford
2022 4:31 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 There is a field in the LE Enclave Control Block called CEEEDB_R13_PARENT which is a pointer to a DSA containing the registers of the enclave parent. If you can be bothered. I would just use IRXINIT("FIN

Re: XLC C/C++, __R1 and Register 0

2022-10-28 Thread Charles Mills
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf Of David Crayford Sent: Friday, October 28, 2022 4:31 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 There is a field in the LE Enclave Control Block called CEEEDB_R13_PARENT which is a pointe

Re: XLC C/C++, __R1 and Register 0

2022-10-28 Thread David Crayford
our J Metz Sent: Friday, October 28, 2022 3:02 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 There are three cases 1. address foo bar baz Pass command bar baz to environment foo address foo bar baz 2. call bar baz Invoke bar with parameter baz; re

Re: XLC C/C++, __R1 and Register 0

2022-10-28 Thread Charles Mills
To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 There are three cases 1. address foo bar baz Pass command bar baz to environment foo address foo bar baz 2. call bar baz Invoke bar with parameter baz; return value optional 3. bar(baz) in an expression

Re: XLC C/C++, __R1 and Register 0

2022-10-28 Thread Seymour J Metz
From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Tony Harminc [t...@harminc.net] Sent: Thursday, October 27, 2022 3:08 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 On Thu, 27 Oct 2022 at 14:30, Charles Mills

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Michael Stein
On Thu, Oct 27, 2022 at 12:14:19PM -0500, Charles Mills wrote: > XLC defines a macro __R1 in stdlib.h. It is the contents of GPR 1 on > entry to the program. Looking at stdlib, it is #defined as __gtab(12) > -- or there may be further #defines farther back -- that is as far as I > have researched.

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Paul Gilmartin
On Thu, 27 Oct 2022 15:43:59 -0500, Charles Mills wrote: > >Yeah, I know how to do a front-end to the C++ but I would rather not add that >complexity. > (Guessing) How about ADDRESS LINKMVS to a minimal function? Just: LRR15,R0 BRR15 Yes, it adds another thing to

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread David Crayford
You can obtain the environment block by calling IRXINIT("FINDENVB ") On 28/10/22 04:43, Charles Mills wrote: But how does REXX invoke a program? Ret = MYFUNC(parm1, parm2) glue code puts the rexx parameters Yeah, I know how to do a front-end to the C++ but I would rather not add that

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Charles Mills
> But how does REXX invoke a program? Ret = MYFUNC(parm1, parm2) > glue code puts the rexx parameters Yeah, I know how to do a front-end to the C++ but I would rather not add that complexity. If no one comes up with a better answer I will just go with passing 0 for the Environment Block

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Colin Paice
sday, October 27, 2022 11:10 AM > To: IBM-MAIN@LISTSERV.UA.EDU > Subject: Re: XLC C/C++, __R1 and Register 0 > > ... > > >3.Any other cool stuff available from __gtab()? > > > No help in < > https://www.ibm.

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Tony Harminc
On Thu, 27 Oct 2022 at 14:30, Charles Mills wrote: > It's being called from Rexx running under zOSMF so would TCBFSA apply? > No, I suppose not. I was thinking this was an EXEC PGM= thing, but on reflection obviously not. But how does REXX invoke a program? (This is a REXX Call statement?)

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Charles Mills
2 11:10 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: XLC C/C++, __R1 and Register 0 ... >3.Any other cool stuff available from __gtab()? > No help in <https://www.ibm.com/docs/en/zos/2.5.0?topic=files-gfunch-gtca-gtab-functions>. Is there any acces

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Charles Mills
++, __R1 and Register 0 On Thu, 27 Oct 2022 at 13:55, Charles Mills wrote: > Thanks. Not sure if that would work, because I suspect that GPR 0 when > my > C++ code starts actually executing is no longer the GPR 0 on entry to > CEESTART. > I'd guess you're right. But surely CEE

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Paul Gilmartin
On Thu, 27 Oct 2022 12:14:19 -0500, Charles Mills wrote: >... >2. Is there any equivalent way to get the contents of GPR 0 (short of writing >an assembler front-end, which is a small PITA of its own)? Why? So a routine >called from Rexx could get the Environment Block address. Or does

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Tony Harminc
On Thu, 27 Oct 2022 at 13:55, Charles Mills wrote: > Thanks. Not sure if that would work, because I suspect that GPR 0 when my > C++ code starts actually executing is no longer the GPR 0 on entry to > CEESTART. > I'd guess you're right. But surely CEESTART will have saved it in TCBFSA, and

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Charles Mills
Thanks. Not sure if that would work, because I suspect that GPR 0 when my C++ code starts actually executing is no longer the GPR 0 on entry to CEESTART. Charles -- For IBM-MAIN subscribe / signoff / archive access

Re: XLC C/C++, __R1 and Register 0

2022-10-27 Thread Colin Paice
I wrote Spice up a C program by using __asm__ to include inline assembler. But this whole area seems not very well documented You could save register 0 in a variable with the assembler code

XLC C/C++, __R1 and Register 0

2022-10-27 Thread Charles Mills
XLC defines a macro __R1 in stdlib.h. It is the contents of GPR 1 on entry to the program. Looking at stdlib, it is #defined as __gtab(12) -- or there may be further #defines farther back -- that is as far as I have researched. I am guessing __gtab() is a magically-defined internal function. I