Intel ARCHITECTURE IA-32 User Manual Page 152

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 151
4-22 Vol. 3A
PROTECTION
The privilege checking rules are different depending on whether the control transfer was initi-
ated with a CALL or a JMP instruction, as shown in Table 4-1.
The DPL field of the call-gate descriptor specifies the numerically highest privilege level from
which a calling procedure can access the call gate; that is, to access a call gate, the CPL of a
calling procedure must be equal to or less than the DPL of the call gate. For example, in
Figure 4-15, call gate A has a DPL of 3. So calling procedures at all CPLs (0 through 3) can
access this call gate, which includes calling procedures in code segments A, B, and C. Call gate
B has a DPL of 2, so only calling procedures at a CPL or 0, 1, or 2 can access call gate B, which
includes calling procedures in code segments B and C. The dotted line shows that a calling
procedure in code segment A cannot access call gate B.
The RPL of the segment selector to a call gate must satisfy the same test as the CPL of the calling
procedure; that is, the RPL must be less than or equal to the DPL of the call gate. In the example
in Figure 4-15, a calling procedure in code segment C can access call gate B using gate selector
B2 or B1, but it could not use gate selector B3 to access call gate B.
If the privilege checks between the calling procedure and call gate are successful, the processor
then checks the DPL of the code-segment descriptor against the CPL of the calling procedure.
Here, the privilege check rules vary between CALL and JMP instructions. Only CALL instruc-
tions can use call gates to transfer program control to more privileged (numerically lower priv-
ilege level) nonconforming code segments; that is, to nonconforming code segments with a DPL
less than the CPL. A JMP instruction can use a call gate only to transfer program control to a
nonconforming code segment with a DPL equal to the CPL. CALL and JMP instruction can both
transfer program control to a more privileged conforming code segment; that is, to a conforming
code segment with a DPL less than or equal to the CPL.
If a call is made to a more privileged (numerically lower privilege level) nonconforming desti-
nation code segment, the CPL is lowered to the DPL of the destination code segment and a stack
switch occurs (see Section 4.8.5, “Stack Switching”). If a call or jump is made to a more privi-
leged conforming destination code segment, the CPL is not changed and no stack switch occurs.
Table 4-1. Privilege Check Rules for Call Gates
Instruction Privilege Check Rules
CALL CPL call gate DPL; RPL call gate DPL
Destination conforming code segment DPL CPL
Destination nonconforming code segment DPL CPL
JMP CPL call gate DPL; RPL call gate DPL
Destination conforming code segment DPL CPL
Destination nonconforming code segment DPL = CPL
Page view 151
1 2 ... 147 148 149 150 151 152 153 154 155 156 157 ... 635 636

Comments to this Manuals

No comments