Intel 253668-032US User Manual

Page of 806
5-20   Vol. 3
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.
5.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 5-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.