Intel syntax addressing: [BASE + INDEX * SCALE + DISPLACEMENT]
AT&T syntax addressing: DISPLACEMENT(BASE, INDEX, SCALE)
So, essentially, in AT&T (gas) syntax it would be:
mov 8(%ebp), %eax
Yes, sizeof(int) will be 4. The reason it's ebp + 8 and not ebp + 4 is because of the function preamble ( push ebp ; mov ebp, esp ) which has already pushed ebp to the stack and reloaded ebp from the new stack pointer, which is now pointing 4 bytes lower.
The stack will look like this:
+12 second int arg
+8 first int arg
+4 return address
SP original ebp value (which the function preamble just pushed)
Last edited by GazL; 09-21-2020 at 09:21 AM.
Reason: fixed stack example - missing return address.
|