ppc405gp and GCC register usage

Paul Mackerras paulus at samba.org
Tue Jul 15 20:51:18 EST 2003


Juergen Beisert writes:

> does someone know, which register I can use in my own assembler routines
> without disturbing code generated by gcc (in kernel space)? I did not found
> any spec which registers gcc use, yet. Is such a document available?

It's defined in the PowerPC ELF ABI document.  Basically a procedure
can use r0 and r3 - r12 without saving and restoring them.  r1 is the
stack pointer, r2 is used by the kernel to hold the pointer to the
task_struct for the current task.  r13 - r31 have to be preserved so
your procedure has to save and restore them if it wants to use them.
Similarly your procedure has to preserve cr2 - cr4 but can use cr0,
cr1, cr5 - cr7, lr, ctr, xer without saving & restoring them.

Unfortunately the PowerPC ELF ABI specification doesn't really have
anyone looking after it at the moment, so I don't know of a public
site where you can get it.  I could send you the pdf if you are
interested.

Paul.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list