public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@codesourcery.com>
To: Mad Props <madprops@gmx.net>
Cc: gcc-help@gcc.gnu.org
Subject: Re: mips calling conventions
Date: Wed, 10 Aug 2005 16:21:00 -0000	[thread overview]
Message-ID: <42FA2990.9030809@codesourcery.com> (raw)
In-Reply-To: <22972.1123682112@www18.gmx.net>

Mad Props wrote:
> Hi,
> 
> I have a question regarding the mips32 calling conventions in gcc. I
> implement in C++ and use assembly when neccessary. As far as I know the
> first four arguments are passed in a0 to a3 but space on the stack still
> needs to be "allocated" for those four arguments. Here is what I've got so
> far:

this is true for integer args, I think (but I'm not sure) floating point args 
are passed differently.  The definitive answer would be in the mips psABI 
document (google is you friend).

> [...]
> mfc0    a0,c0_badvaddr
> subi    sp, sp, 16
> jal     a000a8e8 <foo>
> move    a1,sp  <-- not sure why you have this
> addi    sp, sp, 32
> [...]
> 
> every time a call a C routine in assembly.
Yes, you need to do this.  Though most of the time, you can just have the stack 
permanently depressed through out your function.  GCC does this for instance.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

  reply	other threads:[~2005-08-10 16:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6741.1123680193@www18.gmx.net>
2005-08-10 13:55 ` Mad Props
2005-08-10 16:21   ` Nathan Sidwell [this message]
2005-08-10 19:26 Meissner, Michael
2005-08-10 20:02 MIPS " Nelson H. F. Beebe
2005-08-10 23:21 Meissner, Michael

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=42FA2990.9030809@codesourcery.com \
    --to=nathan@codesourcery.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=madprops@gmx.net \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).