
2-8
PRELIMINARY
Register Sets
Advanci ng the S tandar ds
The Table Indicator (TI) bit of the selector
defines which descriptor table the index points
into. If TI=0, the index references the Global
Descriptor Table (GDT). If TI=1, the index ref-
erences the Local Descriptor Table (LDT). The
GDT and LDT are described in more detail in
Section 2.4.2 (Page 2-16). Protected mode
addressing is discussed further in Sections 2.6.2
(Page 2-52).
The Requested Privilege Level (RPL) field in a
segment selector is used to determine the Effec-
tive Privilege Level of an instruction (where
RPL=0 indicates the most privileged level, and
RPL=3 indicates the least privileged level).
If the level requested by RPL is less than the
Current Program Level (CPL), the RPL level is
accepted and the Effective Privilege Level is
changed to the RPL value. If the level requested
by RPL is greater than CPL, the CPL overrides
the requested RPL and Effective Privilege Level
remains unchanged.
When a segment register is loaded with a seg-
ment selector, the segment base, segment limit
and access rights are loaded from the descriptor
table entry into a user-invisible or hidden por-
tion of the segment register (i.e., cached
on-chip). The CPU does not access the descrip-
tor table entry again until another segment reg-
ister load occurs. If the descriptor tables are
modified in memory, the segment registers must
be reloaded with the new selector values by the
software.
The processor automatically selects an implied
(default) segment register for memory refer-
ences. Table 2-2 describes the selection rules.
In general, data references use the selector con-
tained in the DS register, stack references use
the SS register and instruction fetches use the
CS register. While some of these selections may
be overridden, instruction fetches, stack opera-
tions, and the destination write of string opera-
tions cannot be overridden. Special segment
override instruction prefixes allow the use of
alternate segment registers including the use of
the ES, FS, and GS segment registers.
Table 2-2.
Segment Register Selection Rules
TYPE OF MEMORY REFERENCE
IMPLIED (DEFAULT)
SEGMENT
SEGMENT OVERRIDE
PREFIX
Code Fetch
CS
None
Destination of PUSH, PUSHF, INT, CALL,
PUSHA instructions
SS
None
Source of POP, POPA, POPF, IRET,
RET instructions
SS
None
Destination of STOS, MOVS, REP STOS,
REP MOVS instructions
ES
None
Other data references with effective
address using base registers of:
EAX, EBX, ECX,
EDX, ESI, EDI
EBP, ESP
DS
SS
CS, ES, FS, GS, SS
CS, DS, ES, FS, GS