I don't understand why the following lines are using movl
to push data below the stack pointer are produced by GCC.
movl -4(%ebp), %eax # -4(%ebp) <- local variable 1
movl 8(%ebp), %edx # 8(%ebp) <- first parameter
movl %edx, 8(%esp) # ??? WHY NOT: pushl %edx
movl %eax, 4(%esp) # ??? WHY NOT: pushl %eax
movl -8(%ebp), %eax # ??? WHY NOT: pushl -8(%ebp)
movl %eax, (%esp)
call athena
movl %eax, f
I guess this code tries to push 3 parameters for the function call. But why isn't it using pushl
. What is the usage of this code and how does this work?