3-59
INSTRUCTION SET REFERENCE
CALL—Call Procedure (Continued)
IF call gate code-segment selector index is outside descriptor table limits
THEN #GP(code segment selector); FI;
Read code segment descriptor;
IF code-segment segment descriptor does not indicate a code segment
OR code-segment segment descriptor DPL > CPL
THEN #GP(code segment selector); FI;
IF code segment not present THEN #NP(new code segment selector); FI;
IF code segment is non-conforming AND DPL < CPL
THEN go to MORE-PRIVILEGE;
ELSE go to SAME-PRIVILEGE;
FI;
END;
MORE-PRIVILEGE:
IF current TSS is 32-bit TSS
THEN
TSSstackAddress
<
new code segment (DPL
?
8) + 4
IF (TSSstackAddress + 7)
>
TSS limit
THEN #TS(current TSS selector); FI;
newSS
<
TSSstackAddress + 4;
newESP
<
stack address;
ELSE (* TSS is 16-bit *)
TSSstackAddress
<
new code segment (DPL
?
4) + 2
IF (TSSstackAddress + 4)
>
TSS limit
THEN #TS(current TSS selector); FI;
newESP
<
TSSstackAddress;
newSS
<
TSSstackAddress + 2;
FI;
IF stack segment selector is null THEN #TS(stack segment selector); FI;
IF stack segment selector index is not within its descriptor table limits
THEN #TS(SS selector); FI
Read code segment descriptor;
IF stack segment selectorÂ’s RPL
?
DPL of code segment
OR stack segment DPL
?
DPL of code segment
OR stack segment is not a writable data segment
THEN #TS(SS selector); FI
IF stack segment not present THEN #SS(SS selector); FI;
IF CallGateSize = 32
THEN
IF stack does not have room for parameters plus 16 bytes
THEN #SS(SS selector); FI;
IF CallGate(InstructionPointer) not within code segment limit THEN #GP(0); FI;
SS
<
newSS;
(* segment descriptor information also loaded *)