The C program will treat R1 as 64-bits so you need to clear the high part of the register. Also R15 (the entry to the C program) must be 64-bit address and R14 (your return) needs to be 64-bit. We are successfully calling a 64-bit Metal C set of programs from assembler without issue after a lot of debugging to cleanup the assembler code which had been calling the same set of programs in 31-bit mode. Lloyd
>________________________________ > From: John Parke <[email protected]> >To: [email protected] >Sent: Tuesday, August 6, 2013 4:28 PM >Subject: Re: Metal C - Parms from Assembler Program > > >On Tue, 6 Aug 2013 16:07:01 -0400, Tom Marchant <[email protected]> >wrote: > >>On Tue, 6 Aug 2013 13:57:45 -0400, John Parke wrote: >> >>>Hi: >>> >>>The main Assembler routine is loading R1 with the >>>address of the parameter list and then branching to the Metal-C routine. >> >>Ok so far. >> >>>The >>>Metal-C routine abends with an 0C4. When I look to where R1 is pointing >>>in the >>>dump, it appears to be where a program would pick up a parm if executed in >>>batch; i.e, parm=’someparm.’ >> >>What do you mean by that? The system uses standard linkage to >>provide the PARM from the JCL to the program. Register 1 contains >>the address of a parameter list. The parameter list is one fullword >>containing the address of the parameter. >> >>>But the C program is not a “main” program. >> >>That doesn't make any difference for z/OS linkage conventions. >> >>>I have read the manual repeatedly >> >>What manual is that? The Assembler Programmer's Guide, chapter 2? >>Preferably release 12 or later. >> >>-- >>Tom Marchant > >Manual(s) Read: >z/OS V1R13.0 Metal C Programming Guide and Reference >z/OS V1R13.0 XL C/C++ User’s Guide > >The program I am referring to is written in Assembler and is calling a >metal-C subroutine (assembled with HLASM). > >I execute the program like this: > >//TESTDRV EXEC PGM=TESTDRV <= hand written test program in ASM > >This program is supposed to set up the parm list address then branch to >Metal-C program. When the program TESTDRV is executed it abends with an 0C4. > >I looked into the dump and saw R1 value of something like 00006FF8. > >I thought that this address looked like it was rather low in storage, so I >re-submitted the job with: > >//TESTDRV EXEC PGM=TESTDRV,PARM='someparm' <= not the way I want to >execute > >Now when the program abends, I see the text "someparm" at the address >(preceded by half word length field). > >This leads me to believe that the parm list is not being passed correctly. > >I confirmed the instruction being executed at abend: > >ACTIVE LOAD MODULE ADDRESS=1E800000 OFFSET=0000A78E >NAME=TESTDRV >DATA AT PSW 1E80A788 - E3401000 0004E55C 40200001 > >Which corresponds to: >000000E8 E340 1000 0004 00000000 183 LG 4,@79plist >000000EE E55C 4020 0001 00000020 184 CHSI 32(4),1 > > >Thanks for the help and suggestions. > >John > > >
