#2149 - animension - Thu Jan 30, 2003 4:53 am
Hi guys,
I'm trying to understand how C function parameters get passed into ASM code called by said C code. So far, I know that certain registers hold the values of the parameters and that only up to r3 gets stored directly into registers (all other parameters start on the stack). How would a function like this pass the values to an ASM function?
Which parameters would be stored into the registers directly and which ones into the stack? How does one pass the return value of the function back ( does it need to be in a particular register when "bx lr" is called?)
Do the parameters get bumped up one because there's a return value on the function?
I'd really like to know how to make C and ASM talk to each other so I can get low down on the nitty gritty ASM stuff :)
Thanks
_________________
"Beer is proof that God loves us and wants us to be happy."
-- Benjamin Franklin
I'm trying to understand how C function parameters get passed into ASM code called by said C code. So far, I know that certain registers hold the values of the parameters and that only up to r3 gets stored directly into registers (all other parameters start on the stack). How would a function like this pass the values to an ASM function?
Code: |
u32 myasmfunction( u32 param1, u32 param2, u32 param3, u32 param4, u32 param5 ); |
Which parameters would be stored into the registers directly and which ones into the stack? How does one pass the return value of the function back ( does it need to be in a particular register when "bx lr" is called?)
Do the parameters get bumped up one because there's a return value on the function?
I'd really like to know how to make C and ASM talk to each other so I can get low down on the nitty gritty ASM stuff :)
Thanks
_________________
"Beer is proof that God loves us and wants us to be happy."
-- Benjamin Franklin