From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3F13DA8F.4060403@paulidav.org> Date: Tue, 15 Jul 2003 03:42:23 -0700 From: "Vladimir A. Gurevich" MIME-Version: 1.0 To: jbeisert@eurodsn.de Cc: linuxppc-embedded@lists.linuxppc.org Subject: Re: ppc405gp and GCC register usage References: <200307151224.04020.jbeisert@eurodsn.de> In-Reply-To: <200307151224.04020.jbeisert@eurodsn.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Sender: owner-linuxppc-embedded@lists.linuxppc.org List-Id: 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/