-1

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?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
The amateur programmer
  • 1,238
  • 3
  • 18
  • 38
  • Possible duplicate of http://stackoverflow.com/questions/4003894/what-is-the-0x10-in-the-leal-0x10ebx-eax-x86-assembly-instruction, http://stackoverflow.com/questions/18650093/what-does-a-comma-in-a-parenthesis-mean-in-the-att-syntax-for-x86-assembly, http://stackoverflow.com/questions/26289472/cmp-in-x86-with-parentheses-and-address – Cody Gray - on strike Dec 30 '16 at 06:57

2 Answers2

6

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

Simon
  • 2,721
  • 1
  • 13
  • 15
1

depends on type of first argument - different data types require different amounts of space. If you pass an argument which takes more than 4 bytes, there is no way it can be squeezed into a space with the size that the next argument begins 4 bytes beyond first argument.

Deleted User
  • 2,551
  • 1
  • 11
  • 18