forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

EE-GCC and EE-G++ caling conventions

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Luzarius



Joined: 29 Jun 2006
Posts: 2

PostPosted: Thu Jun 29, 2006 9:33 am    Post subject: EE-GCC and EE-G++ caling conventions Reply with quote

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.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Thu Jun 29, 2006 9:39 am    Post subject: Re: EE-GCC and EE-G++ caling conventions Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Luzarius



Joined: 29 Jun 2006
Posts: 2

PostPosted: Thu Jun 29, 2006 9:44 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Thu Jun 29, 2006 10:01 am    Post subject: Reply with quote

Thats part of the MIPS ABI so I would assume it does ;)
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group