On Tue, 6 Aug 2013 13:43:54 -0600, Steve Comstock <[email protected]> wrote:
>On 8/6/2013 12:48 PM, John Parke wrote: >> Perhaps that is where I am going wrong. >> > >Well, I don't know Metal C linkages, but >some things look suspect to me: > >* your parm list is 64-bit addresses - does > Metal C work with that as default? > >* as mentioned, you might need to have R1 point > to a pointer to your parm list: and the pointer > should be a 31-bit address > >so maybe > > LA R1,Parms >. >. >. >Parms dc a(parmlist) > > >* Your prolog disturbs me a bit; although I > am not aware of the Metal C interface it > seems to go against several conventions: > >LARL R15,@@LIT@2 >Using @@LIT@2,R15 >STMG R14,R12,8(R13) >LGR R9,R1 Save R1 > >LGR R2,R0 <-- Save R0 >LGHI R0,312 <-- Load x'0138' into R0, pad left with binary 0's >LA R1,1 <-- Load x'00000001' into right hand word (RHW) of R0 >SLL R1,20 <-- this shift results in x'00100000' in RHW of R0 >AGR R0,R1 <-- R0 now contains x'00000000 00100138' (why?) > <-- and why such a convoluted path to get, essentially, > <-- a constant result? > >Storage Obtain <-- what parameters are you specifying? > >. >. >. > >-Steve Comstock Some good questions. If you compile C code with LP64 then you get Amode 64, so 8 byte addresses are correct. The 312 into R0 is the length of my DSA (prolog code is from IBM sample). The value in R1 is the called programs DSA, in this case 2**20. So the total Storage Obtain will be for 2**20 + 312. STORAGE OBTAIN,LENGTH=(0),BNDRY=PAGE I thought the problem was PLIST(HOST) vs. PLIST(OS). This tells the compiler whether to use normal "main" passing of R1, i.e. to args. I tried PLIST(OS), but it is ignored when IPA is used. Why? Who knows. Convoluted? Well it is IBM :-)
