Intel ARCHITECTURE IA-32 User Manual Page 149

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 148
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
descriptors 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
87
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
.
0011
P
DPL
Gate Valid
Descriptor Privilege Level
31
0
0
16
31
0
Offset in Segment 63:31
8
0000
0
13 12 11 10 9 8 7
16 15 14 13 12 11
Reserved
Reserved
Type
Page view 148
1 2 ... 144 145 146 147 148 149 150 151 152 153 154 ... 635 636

Comments to this Manuals

No comments