lua-users home
lua-l archive

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

> Not only are some of the register names
> different, but the calling convention is
>different between x86-32 bit (parameters
> passed on the system stack) and x86-6
> bit (first six parameters passed in registers,
> rest on the system stack

By convention, X64 calls have up to four parameters passed in registers (RCX, RDX, R8 and R9). Any additional parameters are pushed on the stack in reverse order.

Functions put their return value in RAX, if there is one.

(After pushing any needed stack parameters, the stack pointer is then shifted downwards to leave room for four temporary values on the stack - the called function can use this space for whatever it likes, such as temporary storage of register parameters. At this point the desired function is CALLed. Oh, and you are supposed to ensure that whenever a CALL happens, the stack pointer RSP is a multiple of 16.)