07-24-2023, 12:31 PM
I disassembled an object file (most likely generated using the Visual C++ compiler) using `DumpBin` and saw the following piece of code:
... ...
mov dword ptr [ebp-4],eax // Why save EAX?
push dword ptr [ebp+14h]
push dword ptr [ebp+10h]
push dword ptr [ebp+0Ch]
push dword ptr [ebp+8]
mov eax,dword ptr [ebp-4] // Why restore EAX? Did it change at all?
call <function>
... ...
Could someone please explain why the EAX register is being saved and restored across these 4 `push` instructions?
... ...
mov dword ptr [ebp-4],eax // Why save EAX?
push dword ptr [ebp+14h]
push dword ptr [ebp+10h]
push dword ptr [ebp+0Ch]
push dword ptr [ebp+8]
mov eax,dword ptr [ebp-4] // Why restore EAX? Did it change at all?
call <function>
... ...
Could someone please explain why the EAX register is being saved and restored across these 4 `push` instructions?