Memory Segment - Stack Segment (SS)

About

The Stack Segment is a segment that holds a stack.

It's a stack implementation of memory locations.

As the stack is a segment, it is a contiguous array of memory locations.

Management

Addressing

When using:

Operations (PUSH|POP)

Items are:

When an item is:

  • pushed onto the stack, the processor decrements the ESP register, then writes the item at the new top of stack.
  • popped off the stack, the processor reads the item from the top of stack, then increments the ESP register.

In this manner, the stack:

  • grows down in memory (towards lesser addresses) when items are pushed on the stack
  • and shrinks up (towards greater addresses) when the items are popped from the stack.

Size

A stack can be up to 4 GBytes long, the maximum size of a segment.

Pointer

Top

The ESP Stack pointer register points to the top of the stack segment.

Base

The EBP Base Pointer general purpose register points to the base of the stack segment

Documentation / Reference


Powered by ComboStrap