Intel ARCHITECTURE IA-32 User Manual Page 148

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 147
4-18 Vol. 3A
PROTECTION
4.8.3 Call Gates
Call gates facilitate controlled transfers of program control between different privilege levels.
They are typically used only in operating systems or executives that use the privilege-level
protection mechanism. Call gates are also useful for transferring program control between 16-bit
and 32-bit code segments, as described in Section 16.4, “Transferring Control Among Mixed-
Size Code Segments.”
Figure 4-8 shows the format of a call-gate descriptor. A call-gate descriptor may reside in the
GDT or in an LDT, but not in the interrupt descriptor table (IDT). It performs six functions:
It specifies the code segment to be accessed.
It defines an entry point for a procedure in the specified code segment.
It specifies the privilege level required for a caller trying to access the procedure.
If a stack switch occurs, it specifies the number of optional parameters to be copied
between stacks.
It defines the size of values to be pushed onto the target stack: 16-bit gates force 16-bit
pushes and 32-bit gates force 32-bit pushes.
It specifies whether the call-gate descriptor is valid.
The segment selector field in a call gate specifies the code segment to be accessed. The offset
field specifies the entry point in the code segment. This entry point is generally to the first
instruction of a specific procedure. The DPL field indicates the privilege level of the call gate,
which in turn is the privilege level required to access the selected procedure through the gate.
The P flag indicates whether the call-gate descriptor is valid. (The presence of the code segment
to which the gate points is indicated by the P flag in the code segment’s descriptor.) The param-
eter count field indicates the number of parameters to copy from the calling procedures stack to
the new stack if a stack switch occurs (see Section 4.8.5, “Stack Switching”). The parameter
count specifies the number of words for 16-bit call gates and doublewords for 32-bit call gates.
Figure 4-8. Call-Gate Descriptor
31
16
15
13
14 12 11
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
Param.
0011
P
DPL
Gate Valid
Descriptor Privilege Level
Count
456
0 0 0
Page view 147
1 2 ... 143 144 145 146 147 148 149 150 151 152 153 ... 635 636

Comments to this Manuals

No comments