Re: mips calling conventions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx    ::     http://www.planetfall.pwp.blueyonder.co.uk


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux