Search code examples
pointersassemblystackstack-pointer

Why does the ESP referring to the address in a stack jumps 4h each time?


Why doesn't the Extended Stack Pointer (ESP) jump 1h in each PUSH or POP operation?


Solution

  • That's because PUSH pushes one whole register to the stack. On 32bit machines, that's four byte's worth of data.

    PUSHQ would change RSP by 8 in x86_64 because it pushes 64 bits.