Why does leave do “mov esp,ebp” in x86 assembly?

mov esp,ebp sets the stack pointer to the base frame address, effectively releasing the whole frame. (Don’t forget that this is Intel syntax, the destination comes first.) If you didn’t do it, once you call ret, you would still be using the called function’s stack frame with your calling function, with crashtastic consequences.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)