For Programmers: Free Programming Magazines  


Home > Archive > A86 Assembler > July 2007 > Re: [Clax86list] Noob Question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [Clax86list] Noob Question
Steven Green

2007-07-03, 6:58 pm

On Tue, 03 Jul 2007 11:24:32 -0700, Charles Crayne wrote:

> On Tue, 03 Jul 2007 12:26:59 GMT
> Steven Green <spamtrap@crayne.org> wrote:
>
>
> The trick is that the C calling conventions have changed. Parameters
> which are passed on the stack in 32-bit mode are passed in registers in
> 64-bit mode, as follows.
>
> ; parameters order:
> ; r9 ; 6th param
> ; r8 ; 5th param
> ; r10 ; 4th param for syscall
> ; rcx ; 4th param for C call
> ; rdx ; 3rd param
> ; rsi ; 2nd param
> ; rdi ; 1st param
>
> -- Chuck


Thank you, this little tidbit got my HW program running.
What happens if you have more than 6 parameters?
Are they put on the stack?

--Steve

Spoon

2007-07-04, 3:57 am

Steven Green wrote:

> On Tue, 03 Jul 2007 11:24:32 -0700, Charles Crayne wrote:
>
>
> Thank you, this little tidbit got my HW program running.
> What happens if you have more than 6 parameters?
> Are they put on the stack?


cf. the AMD64 ABI:
http://www.x86-64.org/documentation/abi.pdf
3.2 Function Calling Sequence

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com