I'm having trouble finding out the answer. From what I've read %ebp has 32-bits, moving %esp to %ebp you'll still have 32-bits, then subtract 70 to 32, and I don't understand the rest. I am new to this so I'm not very proficient. Please give a detailed explanation. Thank you!
Below is the question I am having trouble with.
At the end of this sequence of instructions, how many bytes separate esp and the stored return address on the program's stack? Assume that we called this function using standard 32-bit x86 calling conventions.
804847c functioname:
804847c: push %ebp
804847d: mov %esp,%ebp
804847f: sub $0x70,%esp
8048482: movl $0x0,0x4(%esp)
804848a: movl $0x8048580,(%esp)
sub $0x70,%esp : Reserve 0x70 bytes on the stack.
movl $0x0,0x4(%esp) : Place a zero 32-bit value as argument.
movl $0x8048580,(%esp) : Place an address. The next ret will jump to it.
By standard calling convention, named cdecl, arguments are placed on the stack followed by the address the callee should return to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With