1 ia-32e mode call gates, Ee section 4.8.3.1, “ia-32e mode call gates”) – Intel IA-32 User Manual
Page 149
Vol. 3A 4-19
PROTECTION
Note that the P flag in a gate descriptor is normally always set to 1. If it is set to 0, a not present
(#NP) exception is generated when a program attempts to access the descriptor. The operating
system can use the P flag for special purposes. For example, it could be used to track the number
of times the gate is used. Here, the P flag is initially set to 0 causing a trap to the not-present
exception handler. The exception handler then increments a counter and sets the P flag to 1, so
that on returning from the handler, the gate descriptor will be valid.
4.8.3.1
IA-32e Mode Call Gates
Call-gate descriptors in 32-bit mode provide a 32-bit offset for the instruction pointer (EIP);
64-bit extensions double the size of 32-bit mode call gates in order to store 64-bit instruction
pointers (RIP). See Figure 4-9:
•
The first eight bytes (bytes 7:0) of a 64-bit mode call gate are similar but not identical to
legacy 32-bit mode call gates. The parameter-copy-count field has been removed.
•
Bytes 11:8 hold the upper 32 bits of the target-segment offset in canonical form. A general-
protection exception (#GP) is generated if software attempts to use a call gate with a target
offset that is not in canonical form.
•
16-byte descriptors may reside in the same descriptor table with 16-bit and 32-bit
descriptors. A type field, used for consistency checking, is defined in bits 12:8 of the 64-bit
descriptor’s highest dword (cleared to zero). A general-protection exception (#GP) results
if an attempt is made to access the upper half of a 64-bit mode descriptor as a 32-bit mode
descriptor.
Figure 4-9. Call-Gate Descriptor in IA-32e Mode
31
8 7
0
P
Offset in Segment 31:16
D
P
L
Type
0
4
31
16 15
0
Segment Selector
Offset in Segment 15:00
0
.
0
0
1
1
P
DPL
Gate Valid
Descriptor Privilege Level
31
0
0
16
31
0
Offset in Segment 63:31
8
0
0
0
0
0
13 12 11 10 9 8 7
16 15 14 13 12 11
Reserved
Reserved
Type