User's Manual

5-22 Vol. 3
PROTECTION
5.8.4 Accessing a Code Segment Through a Call Gate
To access a call gate, a far pointer to the gate is provided as a target operand in a
CALL or JMP instruction. The segment selector from this pointer identifies the call
gate (see
Figure 5-10); the offset from the pointer is required, but not used or
checked by the processor. (The offset can be set to any value.)
When the processor has accessed the call gate, it uses the segment selector from the
call gate to locate the segment descriptor for the destination code segment. (This
segment descriptor can be in the GDT or the LDT.) It then combines the base address
from the code-segment descriptor with the offset from the call gate to form the linear
address of the procedure entry point in the code segment.
As shown in Figure 5-11, four different privilege levels are used to check the validity
of a program control transfer through a call gate:
The CPL (current privilege level).
The RPL (requestor's privilege level) of the call gate’s selector.
The DPL (descriptor privilege level) of the call gate descriptor.
The DPL of the segment descriptor of the destination code segment.
The C flag (conforming) in the segment descriptor for the destination code segment
is also checked.
Figure 5-10. Call-Gate Mechanism
Offset
Segment Selector
Far Pointer to Call Gate
Required but not used by processor
Call-Gate
Descriptor
Code-Segment
Descriptor
Descriptor Table
Offset
Base
Base
Offset
Base
Segment Selector
+
Procedure
Entry Point