Search code examples
assemblyx86att

x86 assembly gcc calling conventions esp register


Documentation says that when assembly method is called first argument should be at 4(%esp). If so is the second argument at 8(%esp)?

I really don't get the gnus at&t assembly syntax so what is this following code equal to in intel syntax?

4(%esp)

Is it [esp + 4] or [esp * 4] for example?


Solution

  • 4(%esp) is equivalent to [esp + 4], so assuming your first argument is 4 bytes, your second argument should be at 8(%esp)