At 2:59 PM +0000 1/16/09, Tom Quarendon wrote:
I've got an issue trying to make use of a piece of assembler code
that's coded in a non-reentrant style. Specifically the code doesn't
allocate a save area dynamically, it just allocates space in the
CSECT for it. I've got a driver program in C that's trying to call
the code and when it does I get a segmentation violation at the
point that it tries to write to the save area. The assembler code is
as follows:
USING FRED,15
FRED CSECT
B SAVE-*(15)
L 15,0(1)
B RETURN
SAVE DS 0H
STM 14,12,12(13)
BALR 11,0
LA 0,*-FRED
SLR 11,0
LA 2,SAVEAREA
ST 2,8(13)
ST 13,4(2)
* LR 13,2
B 4(15)
*
RETURN DS 0S
* L 13,SAVEAREA+4
L 14,12(13)
LM 0,12,20(13)
BR 14
LTORG
SAVEAREA DS 18F
END
As it stands above, I can call the code fine. Uncomment the LR 13,2
and the program crashes at that point.
Can anyone help my understand why this doesn't work (other that the
fact that the code is clearly loaded into read-only storage) and
what I'd need to do to make it work? Clearly this kind of style is
allowable in the right environment, I'm just struggling slightly to
understand how I set up that environment. I have complete freedom in
all things, except the above assembler code -- I can't change that.
Otherwise I can do anything, compile options, link/bind options,
driver program etc etc. If the only solution is changing the code
above, I'd like to know that too, and what's required, but that has
to be the absolute last resort. All other possibilities exhausted.
Final option.
I hope I've been (relatively) clear in what I'm trying to do here.
Thanks in advance for any assistance.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html
Any module loaded from an authorized library and marked reentrant is
loaded into key 0 memory so it can't be overlaid. It doesn't have to
be authorized, itself. Either link edit the module as non-reentrant
or move it out of the authorized library.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html