IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Query regarding registers .


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Pankaj Shrivastava
Currently Banned

New User


Joined: 24 Jul 2009
Posts: 51
Location: Pune

PostPosted: Mon Jul 27, 2009 6:54 pm
Reply with quote

Hi All ,

This could be a very basic question , But conceptually I have no clue about the real story at the the hardware level .
When we say that we are working with registers of machine , Does this mean that a particular register is exclusively used by the program at a time . If yes ..then how does maniframe operates so many program at the same time using a set of registers , And if No then how does it cater to so many programs running using a limited number of registers .

Thanks
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 27, 2009 7:06 pm
Reply with quote

You may want to find a copy of the z/Architecture Principles of Operation and read it for a while. When the system stops executing an address space and starts executing another one, memory (which includes the registers) is stored for the old address space, then loaded for the new address space. So every program running has its own complete set of registers that remain uniquely assigned for it.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jul 27, 2009 7:07 pm
Reply with quote

In Assembler application programs, unless you know what you're doing, don't use R0, R1, R13, R14 and R15 as they are used by System Level Services/Macros, etc (except R13), but R13 contains the address of the current program's 18 word savearea and you need to leave this register alone as well.

Also, if this is a sub-program called by a HLL which is LE compliant, avoid using R12 because it normally contains the address of the LE "CAA" (Common Anchor Area).

Bill
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Tue Nov 30, 2010 3:16 pm
Reply with quote

I'm new to Assembler, please allow me to ask a stupid question:
I find almost in all sub program, below segment is coded:
Code:
STM R14,R12,12(R13)

I know this is storing the register contents of calling program to Register 13, but why it's always 12(R13) rather than 4(R13),8(R13)?

Thanks for your kind reply in advance!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 30, 2010 5:15 pm
Reply with quote

The Assembler save area linkage convention requires it. The first 4 bytes of the save area are reserved, followed by 4 bytes of previous save area address, followed by 4 bytes of next save area address, followed by registers. Since the first 12 bytes are reserved, the registers must be stored at offset 12(R13). If properly constructed, the address of the save area IN YOUR PROGRAM will be stored at 8(R13).
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 30, 2010 10:08 pm
Reply with quote

Hello,

Every assembler module you write should follow the standard linkage conventions. To do otherwise can cause all sorts of problems when modules call or are called by other modules.

There is more than the single instructoin and there should also be code that is executed when your code returns control to whatever invoked it.

Many organizations have macros defined for this purpose.
Back to top
View user's profile Send private message
dejunzhu

Active User


Joined: 08 May 2008
Posts: 390
Location: China

PostPosted: Wed Dec 01, 2010 7:52 am
Reply with quote

Thank you very much!
I'll remember it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top