ppc405gp and GCC register usage

Vladimir A. Gurevich vag at paulidav.org
Tue Jul 15 20:42:23 EST 2003


Hi Juergen,

There is a standard, called ABI (Application Binary Interface) that
defines this.
ABIs are, obviuosly, CPU-specific. Compilers tend to respect ABI that
is defined for the CPU they generate code for.

The best documents specifying PPC ABI can be found on IBM's website:

PowerPC Compiler Writer's Guide
http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF7785256996007558C6/$file/cwg.pdf

Developing PowerPC Embedded Application Binary Interface (EABI)
Compliant Programs
http://www-3.ibm.com/chips/techlib/techlib.nsf/techdocs/852569B20050FF77852569970071B0D6/$file/eabi_app.pdf

They not only describe register usage, but stack layout, parameter
passing and many
other things. There are a couple of slightly different ABI's for
PowerPC, that differ
with regards to R2 and R13 usage to access the so-called small data
sections.

Also, depending on what you are doing you have 2 options:
   -- do the whole function in assembly. You are free to do whatever (as
long as you
      obey the ABI), but you've got to watch register allocation
yourself (among other
      thing)
   -- Use __asm__ in your C code. Then the compiler will do most of the
register
       allocation for you and will help you with ABI issues as well.

Happy Hacking,
Vladimir

Juergen Beisert wrote:

>Hello all,
>
>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?
>
>-- JB
>
>
>


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





More information about the Linuxppc-embedded mailing list