ESP .
, - , ESP , .
EBP, ESP.
, , ESP EBP.
ESP, , , ESP.
:
add esp,8
mov ecx,[esp-4] //never access data outside the actual stack.
pop eax
sub esp,12
, .
, , , . , , , , ().
: , ESP, , , ESP,
stack frame. (, ), , .
, ESP , ESP .
A - ESP
B - ESP.
A: B: .
?
add esp,8 //equivalent to pop anyreg, pop anyreg
pop eax //pop from the (new) top of the stack.
sub esp,12 //reset the stack back to where is was.
!
sub esp,12, 3 , , , .
.
mov eax,[esp+8]
A: , B: , C: , D: E: .
/
- FLAGS, , LEA . , add/sub, , (, , LEA 2 4 ALU Ryzen Haswell ). .
lea esp,[esp+8] == add esp,8 (but without altering the flags).
lea edx, [esp+8] ; copy-and-add replacing mov + add is very useful
LEA, 2 , /, .