The Data Segments

Selecting and Accessing a Data Segment

The post-286 processors have four data segment registers: DS, ES, FS and GS. They identify up to four separate data segments (in memory) that can be accessed by the currently executing program.

To access data within one of the four data segments, the programmer must first load a 16-bit value into the respective data segment register. In Real Mode, the value in a data segment register specifies the upper 16 bits of the 20 bit memory start address of the data segment. In Protected Mode, the value selects a segment descriptor in either the GDT or LDT. Figure 9-1 on page 160 illustrates the format of a data segment descriptor. The example

 mov ax, 4f36 ;load ds register mov ds, ax ; mov al, ...

Get The Unabridged Pentium 4 IA32 Processor Genealogy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.