|
|
|
|
|
by mirkules
5226 days ago
|
|
Thanks for that link. Reading through one of the first sections about pushing parameters to the stack, I noticed the call: gcc -S -o example1.s example1.c However, example1.s looks very different on Mac than on Linux, in particular, on Mac the parameters are pushed in reverse order: Leh_func_begin2:
... movl $1, %eax
movl $2, %ecx
movl $3, %edx
movl %eax, %edi
movl %ecx, %esi
callq _function
Whereas on Linux, they are pushed in the order specified in that link: movl $3, %edx
movl $2, %esi
movl $1, %edi
call function
What is the reason behind this? Is it that the stack on OS X is implemented to grow up instead of down? |
|