addressability of a program



High Level Assembler(HLASM) for MVS & VM & VSE

addressability of a program

Postby rahul2380 » Tue Jan 29, 2008 8:21 am

Hi, could anyone let know, how is the addressability of a called program set when we make a call for it. What all instructions are involved and how is the data of the calling program saved in savearea. Thanx
rahul2380
 
Posts: 1
Joined: Tue Jan 29, 2008 8:17 am
Has thanked: 0 time
Been thanked: 0 time

Re: addressability of a program

 

Re: addressability of a program

Postby dick scherrer » Wed Jan 30, 2008 3:10 am

Hello Rahul and welcome to the forums,

how is the addressability of a called program set when we make a call for it
When you call a sub-program, the addressability is done the same as when the main program is invoked by the operating system. This is usually known as the "standard linkage convention".

how is the data of the calling program saved in savearea
The caller's data is not saved in the savearea. The save area stores register content.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: addressability of a program

Postby tsjurseth » Thu Feb 21, 2008 9:46 pm

Since no one have helped you I will give this information.

The POPs manual is the king of manuals when dealing with assembler.
POP is the Principle of Operations.

The actual instructions are as follows and should be built into a startup macro.
This the from my days in the 370 market place.

an online version can be found here. http://publibz.boulder.ibm.com/cgi-bin/ ... 0504121320


Assembler codeing can begin in any collum other then 1. if its in col. 1 then its a label.

The called pgm must have the follwing instructions to follow the rules.
  stm  r14,r12,12(r13)        save the callers registers into the new pgms save area.  ( of couse this is non-reentrant)
  balr r12,0                        set addresserrablilty with r12 for use as base reg
  using *,r12                      give address ability to the next 4096 bytes with addressability
  st   r13,savearea+4         save the old savearea 4 into the new save area
  la   r13,savearea             load r13 with new savearea address
  st   r13,savearea+8         save new savearea address

your special code

to return to caller
 l    r13,4(r13)                restore the callers save area
 lm   r14,r12,12(r13)      restore the original registers from who called you
 br   r14                         return to caller
savearea 0d                   allign on double word boundary. 
 ds   18f   



Have at it. Any questions. TKS
tsjurseth
 
Posts: 1
Joined: Tue Feb 19, 2008 10:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: addressability of a program

Postby CICS Guy » Thu Feb 21, 2008 10:01 pm

tsjurseth wrote: stm r14,r12,12(r13) save the callers registers into the new pgms save area. ( of couse this is non-reentrant)
IIRC, r13 is pointing to a save area in the calling program, isn't it?
balr r12,0 set addresserrablilty with r12 for use as base reg
using *,r12 give address ability to the next 4096 bytes with addressability
Why use another register, isn't r15 already pointing to the entyry point?
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: addressability of a program

Postby dickvb » Wed Mar 05, 2008 9:02 pm

tsjurseth wrote: stm r14,r12,12(r13) save the callers registers into the new pgms save area. ( of couse this is non-reentrant)

IIRC, r13 is pointing to a save area in the calling program, isn't it?


In the calling program or provided by the calling program, yes.
(It could well be "provided by" the calling program and be entirely re-entrant..)

balr r12,0 set addresserrablilty with r12 for use as base reg
using *,r12 give address ability to the next 4096 bytes with addressability


Why use another register, isn't r15 already pointing to the entyry point?


Yes, but if your module is going to do anything non-trivial, such as use any system or
I/O macros, R15 is going to get modified. Much safer, and more standard-observant,
to provide your own base register.
dickvb
 
Posts: 1
Joined: Wed Mar 05, 2008 7:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: addressability of a program

Postby CICS Guy » Wed Mar 05, 2008 10:05 pm

dickvb wrote:In the calling program or provided by the calling program, yes.
'Standard linkage'......
Yes, but if your module is going to do anything non-trivial, such as use any system or
I/O macros, R15 is going to get modified. Much safer, and more standard-observant,
to provide your own base register.
Correct, but I'd assumed the programmer would know that....grin.....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time


Return to Assembler

 


  • Related topics
    Replies
    Views
    Last post