| View previous topic :: View next topic |
| Author |
Message |
Luzarius
Joined: 29 Jun 2006 Posts: 2
|
Posted: Thu Jun 29, 2006 9:33 am Post subject: EE-GCC and EE-G++ caling conventions |
|
|
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 |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Thu Jun 29, 2006 9:39 am Post subject: Re: EE-GCC and EE-G++ caling conventions |
|
|
| 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 |
|
 |
Luzarius
Joined: 29 Jun 2006 Posts: 2
|
Posted: Thu Jun 29, 2006 9:44 am Post subject: |
|
|
| 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 |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Thu Jun 29, 2006 10:01 am Post subject: |
|
|
Thats part of the MIPS ABI so I would assume it does ;) _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
|