DENX . DULG . LinuxKernelRegisterUsage

14.3.4. Linux kernel register usage

For the Power Architecture architecture, the Linux kernel uses the following registers:

R1:
stack pointer
R2:
pointer to task_struct for the current task
R3-R4:
parameter passing and return values
R5-R10:
parameter passing
R13:
small data area pointer
R30:
GOT pointer
R31:
frame pointer

A function can use r0 and r3 - r12 without saving and restoring them. r13 - r31 have to be preserved so they must be saved and restored when you want to use them. Also, cr2 - cr4 must be preserved, while cr0, cr1, cr5 - cr7, lr, ctr and xer can be used without saving & restoring them. [ Posted Tue, 15 Jul 2003 by Paul Mackerras to linuxppc-embedded@lists.linuxppc.org ].

See also the (E)ABI specifications for the Power Architecture architecture, Developing PowerPC Embedded Application Binary Interface (EABI) Compliant Programs

----- Revision r1.3 - 07 Aug 2009 - 19:56 - WolfgangDenk
Copyright © 2002-2019 by DENX Software Engineering