Vol. 3A 5-11
PROTECTION
•
The DPL of the segment descriptor for the destination code segment that contains the called procedure.
•
The RPL of the segment selector of the destination code segment.
•
The conforming (C) flag in the segment descriptor for the destination code segment, which determines whether
the segment is a conforming (C flag is set) or nonconforming (C flag is clear) code segment. See Section
3.4.5.1, “Code- and Data-Segment Descriptor Types,” for more information about this flag.
The rules that the processor uses to check the CPL, RPL, and DPL depends on the setting of the C flag, as described
in the following sections.
5.8.1.1
Accessing Nonconforming Code Segments
When accessing nonconforming code segments, the CPL of the calling procedure must be equal to the DPL of the
destination code segment; otherwise, the processor generates a general-protection exception (#GP). For example
in Figure 5-7:
•
Code segment C is a nonconforming code segment. A procedure in code segment A can call a procedure in code
segment C (using segment selector C1) because they are at the same privilege level (CPL of code segment A is
equal to the DPL of code segment C).
•
A procedure in code segment B cannot call a procedure in code segment C (using segment selector C2 or C1)
because the two code segments are at different privilege levels.
Figure 5-6. Privilege Check for Control Transfer Without Using a Gate
CPL
RPL
DPL
Privilege
Check
CS Register
Segment Selector
For Code Segment
Destination Code
Segment Descriptor
C