What does subl do here?
Posted
by drozzy
on Stack Overflow
See other posts from Stack Overflow
or by drozzy
Published on 2010-03-17T19:27:31Z
Indexed on
2010/03/17
19:31 UTC
Read the original article
Hit count: 355
assembly
So... I'm compiling into assembler, with gcc -S -O2 -m32:
void h(int y){int x; x=y+1; f(y); f(2); }
And it gives me the following:
.file "sample.c"
.text
.p2align 4,,15
.globl h
.type h, @function
h:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
movl 8(%ebp), %eax
movl %eax, (%esp)
call f
movl $2, 8(%ebp)
leave
jmp f
.size h, .-h
.ident "GCC: (GNU) 4.4.3 20100127 (Red Hat 4.4.3-4)"
.section .note.GNU-stack,"",@progbits
Now I know what pushl and movel: they store the current frame pointer onto the stack and then set the value of the frame pointer register to the value of the Stack Pointer.
But I have no idea what the subl $24, %esp is. Thanks!
© Stack Overflow or respective owner