I\'m learning Assembly language. What exactly is argument push order? i understand its how arguments are pushed to the stack but what does the left and right part mean? left or
The processor knows no 'function arguments'. Therefore when you want to write f(a,b,c)
, you really need to push the arguments 'somewhere'.
This is convention. I know that on most x86 machines, function arguments are pushed on the stack from right to left, i.e. first c, then b, then a.
push c
push b
push a
call f
Now the called function can use ebx -1
for a, ebx - 2
for b and ebx - 3
for c.
You could as well establish a convention that says: first two arguments are in registers ebx
and ecx
, rest are on the stack. As long as the caller and callee agree, you're fine.