EE-GCC and EE-G++ caling conventions

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Luzarius
Posts: 2
Joined: Thu Jun 29, 2006 9:24 am

EE-GCC and EE-G++ caling conventions

Post by Luzarius »

I want to call c++ or c functions compiled with e-gcc or e-g++ from my assembly code but i am not sure how the compilers handle passing of arguments and return values.
Do they use the stack or registers $a0-$a3 and $v0-$v1 ?
a simple test program compiled with the -S assembly source option showed that it uses the registers but a few online message boards say GCC compilers use the stack.
Does this differ depending on how many arguments there are?
I'd be grateful for any information on this or a link to an article that covers this. thanks.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Re: EE-GCC and EE-G++ caling conventions

Post by Drakonite »

Luzarius wrote: Does this differ depending on how many arguments there are?
Yep. Specifically the first so many arguments are in registers, then if they are more they go on the stack.
Shoot Pixels Not People!
Makeshift Development
Luzarius
Posts: 2
Joined: Thu Jun 29, 2006 9:24 am

Post by Luzarius »

Cool thanks. Also i should ask if these compilers follow the convention of not messing with registers $s0-$s7 or at least restoring them before returning to the caller.
User avatar
Drakonite
Site Admin
Posts: 990
Joined: Sat Jan 17, 2004 1:30 am
Contact:

Post by Drakonite »

Thats part of the MIPS ABI so I would assume it does ;)
Shoot Pixels Not People!
Makeshift Development
Post Reply