What does ebp and esp mean in disassembly code?

Below is my code. Help me understand what the following code means:

push ebp mov ebp, esp sub esp, 230h 
-3
source share
1 answer

This is the prologue function.

It pushes the old base pointer onto the stack, so it can be restored later:

  push ebp 

Assigns the value of the stack pointer to the base pointer, then a new stack stack will be created on top of the old stack frame:

  mov ebp, esp 

Then it moves the stack pointer, decreasing or increasing its value (depending on whether the stack grows up or up):

  sub esp, 230h 

Here, the immediate value of 230h is the number of bytes reserved on the stack for local use in the function.

Similarly, the epilogue function cancels the prolog and returns control to the calling function.

Check out this related SO question: Prolog and Epilogue function in C

+1
source

Source: https://habr.com/ru/post/985653/


All Articles