looking at the following code:
(ebp-0x8 -> int)
(ebp-0x4 -> int*)
=> 0x80483f3 <main+6>: mov DWORD PTR [ebp-0x8],0x0
0x80483fa <main+13>: mov DWORD PTR [ebp-0x4],0x0
0x8048401 <main+20>: mov DWORD PTR [ebp-0x8],0xa
0x8048408 <main+27>: lea eax,[ebp-0x8]
0x804840b <main+30>: mov DWORD PTR [ebp-0x4],eax
0x804840e <main+33>: mov eax,0x0
0x8048413 <main+38>: leave
0x8048414 <main+39>: ret
Is the LEA command at really needed? I know the following expression is wrong and not valid, regardless the wrong addresses on the left, but is there no similarly way to make it like this?
=> 0x80483f3 <main+6>: mov DWORD PTR [ebp-0x8],0x0
0x80483fa <main+13>: mov DWORD PTR [ebp-0x4],0x0
0x8048401 <main+20>: mov DWORD PTR [ebp-0x8],0xa
0x804840b <main+30>: mov DWORD PTR [ebp-0x4],ebp-0x8
0x804840e <main+33>: mov eax,0x0
0x8048413 <main+38>: leave
0x8048414 <main+39>: ret
I think its not possible but I wanted to get sure.
And last question, the expression ebp-0x8
would theoretically return the "content of the ebp
register minus 0x8
".
So the expression [ebp-0x8]
would return the content of the memory at the address "content of the ebp
register minus 0x8
".
Now I am wondering how the LEA command can get the memory address if its only get the content of some bytes in the memory.
Sorry if there are some dumb questions but the [ ] can sometimes be very confusing.