d ===>                                          
   IMPORT CODE64,'SYSADATA','opendata'          
   ENTRY CELQSTRT                               
   NAME TESTPRGD(R)                             
 /*                                             
 //                                             

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Barry Lichtenstein
Sent: Thursday, August 22, 2019 6:11 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: 64 bit Assembler DLL app PSECT parm

The value of R5 on entry to an XPLINK (which include AMODE 64) function is not 
the address of the WSA in its entirety (as R0 was in non-XPLINK), but rather 
the value of the "environment" of that function, which is somewhere within the 
WSA of that module (executable file).  (As implemented I believe it's the same 
for the entire compilation unit, but the specification is that it corresponds 
to the function.)  The environment address comes from the caller loading the 
function descriptor -- the R-con/V-con pair for that function.  Where 
V(function) gives the address of the code, R(function) gives the address of the 
"environment".  That then gives the function the base location for its 
"writable-static area" on entry -- the non-reentrant area containing writable 
data items and static data items.  

Thus when an XPLINK function is to call another function (exception OS 
linkage), it needs a descriptor to do so.  As the address of the environment is 
unique to each instance of the program (LE enclave), the descriptor of a 
RENT-compiled program has to live in the WSA so that it can be updated with the 
environment address of the target program, unlike a V-con which can be 
relocated during load time.  (The V-con in the descriptor also needs to be 
updated in support of DLLs, i.e. if the function being called is not within the 
calling module).

The net of this is that in XPLINK you need the PSECT in concert with the call 
macro (CELQCALL), and that call macro automatically takes care of allocating 
the descriptor.  The manual says only under the CELQCALL usage notes:
  
  2. This macro requires that a PSECT was defined by the CELQPRLG prolog macro

Though I don't see where there is a similar note, CEEPDDA and CEEPLDA also both 
require a PSECT for XPLINK (perhaps because these macros also work for 
non-XPLINK DLLs).  These allow you to define and reference data items your 
environment (WSA) which are exportable/importable respectively.


On 21 Aug 2019 11:17:24 AM Joseph Reichman <reichman...@gmail.com> wrote:
> Just looked thru LE book shelf would be nice If they had programming 
> examples Or at the very least documentation on the parameters used for 
> the EDC macros

----------------------------------------------------------------------
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

Reply via email to