View previous topic :: View next topic
|
Author |
Message |
Pankaj Shrivastava Currently Banned New User
Joined: 24 Jul 2009 Posts: 51 Location: Pune
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dejunzhu
Active User
Joined: 08 May 2008 Posts: 390 Location: China
|
|
|
|
Thank you very much!
I'll remember it. |
|
Back to top |
|
|
|