Memory Segment - Segment Register

Cpu Memory Management Segmented Model


The segment registers (CS, DS, SS, ES, FS, and GS) hold 16-bit segment selectors

To access a particular segment in memory, the segment selector for that segment must be present in the appropriate segment register.

Initialization by memory model

How segment registers are used depends on the type of memory management model that the operating system or executive is using.


When using the flat (unsegmented) memory model, segment registers are loaded with segment selectors that point to overlapping segments, each of which begins at address 0 of the linear address space.

These overlapping segments then comprise the linear address space for the program.

Typically, two overlapping segments are defined:.

Overlapping Segment Value Data Type
The CS segment register code segment for code
All the other segment registers
(DS, SS, ES, FS, and GS)
data segment and
stack segment
for data and stacks

Segment Register Init Flat Memory Model


When using the segmented memory model, each segment register is ordinarily loaded with a different segment selector so that each segment register points to a different segment within the linear address space.

At any time, a program can thus access up to six segments that are mapped to the same linear address space.

To access a segment not pointed to by one of the segment registers, a program must first load the segment selector for the segment to be accessed into a segment register.

Segment Register Init Segmented Memory Model

Each of the segment registers is associated with one of three types of storage:

Types of storage Segment Register
Program Data Type - Code DS register point to four code segments
Program Data Type - Data DS, ES, FS, and GS registers point to four data segments
Program Data Type - Stack SS register point to four stack segments

64 bit

In 64-bit mode: CS, DS, ES, SS are treated as if each segment base is 0, regardless of the value of the associated segment descriptor base. This creates a flat address space for code, data, and stack. FS and GS are exceptions.

Both segment registers may be used as additional base registers in linear address calculations (in the addressing of local data and certain operating system data structures).

Documentation / Reference

Discover More
Cpu Memory Management Segmented Model
Code Segment (CS)

The code segment is a segment that stores the code data type of a program. Ie it stores the instructions being executed. The next instruction to be executed in the code segment is located by the...
Card Puncher Data Processing
Instruction - Fetch

Fetch is a step in the the cycle of an instruction. The processor fetches instructions from the code segment, using a logical address that consists of: the segment selector in the CS register ...
Cpu Memory Management Segmented Model
Memory - Segment

A memory segment is the division structure of the segmented memory model. The physical address spec (physical memory) of the primary memory is divide by segment. See virtual memoryvirtual segment ...
Cpu Memory Management Segmented Model
Memory Segment - Data Segment (DS) - (ES, FS, GS)

The data segment are a segments that stores the data bit type. The availability of four data segments permits efficient and secure access to different types of data structures. For example, four...
Logical Address Segment
Memory Segment - Logical Address (pointers)

To address a byte in a segmented model, a program uses an address called a logical address Logical addresses are often referred to as pointers. where: Segment-register is a segment selector that...
Cpu Memory Management Segmented Model
Memory Segment - Segment Selector

A segment selector is the unique identifier of a segment and is used in the first part of logical address. See logical address syntax It is a special pointer that identifies a segment in memory. Its...
Cpu Memory Management Segmented Model
Memory Segment - Stack Segment (SS)

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. When using: the...
Z80 Registers
Processor - (Execution) Register

Register for a processor. They are located inside the processor. They are the quickest memory and are then located at the top of the memory hierarchy. Zoom of CPU register of the Z80 processor (Source)...

Share this page:
Follow us:
Task Runner