Search code examples
assemblyx86att

What does the minus sign mean in a `movl` instruction?


I have this assembly code:

movl -4(%ebp),%eax

What does the -4 before the (%ebp) mean?


Solution

  • The -4 is a constant offset to the pointer held by the register. This code reads the long value at ebp - 4 and stores it in eax. This is AT&T syntax; the Intel syntax for the same instruction would be mov eax, dword ptr [ebp-4].