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

Re: [f-cpu] Call convention resume



On Sun, Jun 23, 2002 at 02:10:57PM +0000, cedric wrote:
> Hi every body,
> 
> 	I will try to do a resume of what has been say about call convention during 
> the last week, before updating the manual.
> 
> R0: zero
> R1 : number of parameter (for debug and security) and return value

I still do not agree with that point. It's a waste.

> R2-R15 : functions arguments (call-clobbered)
> 
> R15-R31 : temporary registers (call-clobbered)
> R32-R58 : local registers (callee-saver)
> 
> R59 : return adress
> 
> R60 : pointer to the Procedure Linkage Table
> R61 : pointer to the Global Offset Table
> 
> R62 : Frame pointer (Function Entry Frame)
> R63 : stack pointer after which the parameters after the 14th are push in 
> reverse order (Function Entry Frame - number of bytes allocated)

Better make r61 (or r63) the return address. Statically linked programs
don't use the PLT and GOT pointers, and we don't want to have a hole in
the middle.

The stack pointer is always the end of the allocated area on the stack.
If a program uses memory from the stack, it MUST move the stack pointer.
That way, the operating system can tell how big the user mode stack is.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/