Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Mac OS Runtime Architectures /
Chapter 4 - PowerPC Runtime Conventions / Routine Calling Conventions


Register Preservation

Table 4-3 lists registers used in the PowerPC runtime environment and their volatility in routine calls. Registers that retain their value after a routine call are called nonvolatile. All registers are 4 bytes long.
Table 4-3 Volatile and nonvolatile registers
TypeRegisterPreserved by a
routine call?
Notes
General- purpose registerGPR0No 
 GPR1See next columnUsed as the stack pointer to store parameters and other temporary data items.
 
General- purpose register GPR2See next columnUsed as the base register to access the direct data area. GPR2 is preserved by direct calls; for indirect calls the caller must restore the value after the call.
 GPR3See next columnHolds the return value or the address of the return value in function calls. For routine calls that do not return a value, GPR3 is used to pass parameter values.
 GPR4-GPR10NoUsed to pass parameter values in routine calls.
 GPR11-GPR12No 
 GPR13-GPR31Yes 
Floating- point registerFPR0No 
 FPR1-FPR13NoUsed to pass floating- point parameters in routine calls.
 FPR14-FPR31Yes 
Link RegisterLRNoStores the return address of the calling routine during a routine call.
Count RegisterCTRNo 
 
Fixed-point exception registerXERNo 
Condition RegistersCR0-CR1No 
 CR2-CR4Yes
 CR5-CR7No


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 MARCH 1997