Let us start this all with the special register esp. This is called the “stack pointer”.
esp can be used as any other register in most instructions. This includes, but is not limited to, movl, cmpl, addl, subl and etc.
However, esp is also a special register. Certain instructions affect only esp, even though it is not an operand of these instructions. In other words, certain instructions implicitly utilize esp.
Technically, esp “points to the last byte pushed on the stack”. Furthermore, stack locations with an address that is greater than or equal to esp is said to be used, whereas stack locations with an address that is less than esp is said to be available. In other words, esp is a bookmark of sorts, separating the used portion of a stack from the unused portion.
You can consider the stack as a region of memory allocated for a special purpose.
We’ll discuss what this means in the next few sections.