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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.