Author Topic: What registers hold which values for function calls? (64- bit)  (Read 9232 times)

Offline turtle13

  • Jr. Member
  • *
  • Posts: 73
What registers hold which values for function calls? (64- bit)
« 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?

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: What registers hold which values for function calls? (64- bit)
« Reply #1 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