Memory Segment - Stack Segment (SS)

> Computer System > Computer - Memory (Physical memory) > Memory - Segment

1 - 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.


3 - Management

3.1 - Addressing

When using:

3.2 - 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.

3.3 - Size

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

3.3.1 - 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

4 - Documentation / Reference