Reputation: 2617
What does this line do in the following code?
0x0804840c <+3>: mov 0x8(%ebp),%edx
I know mov %x, %y moves reg value %x to %y, but stack offset 8 has never been set as anything, so I'm not sure what is being moved to %edx. I'm really new to assembly and I'm completely lost.
(IA32 Assembly)
0x08048409 <+0>: push %ebp
0x0804840a <+1>: mov %esp,%ebp
0x0804840c <+3>: mov 0x8(%ebp),%edx
0x0804840f <+6>: mov %edx,%eax
0x08048411 <+8>: shl $0x4,%eax
0x08048414 <+11>: sub %edx,%eax
0x08048416 <+13>: pop %ebp
0x08048417 <+14>: ret
Upvotes: 0
Views: 192
Reputation: 140445
This is the 32-bit x86 ELF ABI, looks like, so the stack slot at 8(%ebp)
holds argument 1 to this function, put there by the caller.
The overall function computes (x << 4) - x
.
Upvotes: 3