mips calling conventions
Nathan Sidwell
nathan@codesourcery.com
Wed Aug 10 16:21:00 GMT 2005
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
More information about the Gcc-help
mailing list