NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: turtle13 on September 25, 2018, 06:23:24 AM

Title: What registers hold which values for function calls? (64- bit)
Post by: turtle13 on September 25, 2018, 06:23:24 AM
This might be more of an Intel specific question but which registers hold what values in a function call? For ex. strlen( ), when it returns the size of the string, what "register" is that value passed into? How can I discover which functions pass what values to/ from registers?
Title: Re: What registers hold which values for function calls? (64- bit)
Post by: Frank Kotler on September 25, 2018, 06:58:54 AM
 Hi Turtle13,

Keeping in mind that I'm not good at 64-bit code... it is not really an Intel specific question but a "calling convention" question. Linux and Windows, in their infinite wisdom, do it differently! You can, at least, expect an integer return value in rax...

This might be a place to start...

https://www.agner.org/optimize/calling_conventions.pdf

Good Luck!

Best,
Frank