On Fri, 16 Jan 2009 14:59:19 +0000 Tom Quarendon <tom.quaren...@teamwpc.co.uk> 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. If the only r/w area is the savearea, change the code to use the linkage stack. BAKR R14,0 * leave R13 as it is at the end PR , -- Binyamin Dissen <bdis...@dissensoftware.com> http://www.dissensoftware.com Director, Dissen Software, Bar & Grill - Israel Should you use the mailblocks package and expect a response from me, you should preauthorize the dissensoftware.com domain. I very rarely bother responding to challenge/response systems, especially those from irresponsible companies. ---------------------------------------------------------------------- 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