linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir A. Gurevich" <vag@paulidav.org>
To: jbeisert@eurodsn.de
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: ppc405gp and GCC register usage
Date: Tue, 15 Jul 2003 03:42:23 -0700	[thread overview]
Message-ID: <3F13DA8F.4060403@paulidav.org> (raw)
In-Reply-To: <200307151224.04020.jbeisert@eurodsn.de>


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/

  parent reply	other threads:[~2003-07-15 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-15 10:24 ppc405gp and GCC register usage Juergen Beisert
2003-07-15 10:40 ` Wolfgang Denk
2003-07-15 10:42 ` Vladimir A. Gurevich [this message]
2003-07-15 11:31   ` Juergen Beisert
2003-07-15 10:51 ` Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F13DA8F.4060403@paulidav.org \
    --to=vag@paulidav.org \
    --cc=jbeisert@eurodsn.de \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).