3-60
INSTRUCTION SET REFERENCE
CALLCall Procedure (Continued)
ESP
<
newESP;
CS:EIP
<
CallGate(CS:InstructionPointer);
(* segment descriptor information also loaded *)
Push(oldSS:oldESP); (* from calling procedure *)
temp
<
parameter count from call gate, masked to 5 bits;
Push(parameters from calling procedures stack, temp)
Push(oldCS:oldEIP); (* return address to calling procedure *)
ELSE (* CallGateSize = 16 *)
IF stack does not have room for parameters plus 8 bytes
THEN #SS(SS selector); FI;
IF (CallGate(InstructionPointer) AND FFFFH) not within code segment limit
THEN #GP(0); FI;
SS
<
newSS;
(* segment descriptor information also loaded *)
ESP
<
newESP;
CS:IP
<
CallGate(CS:InstructionPointer);
(* segment descriptor information also loaded *)
Push(oldSS:oldESP); (* from calling procedure *)
temp
<
parameter count from call gate, masked to 5 bits;
Push(parameters from calling procedures stack, temp)
Push(oldCS:oldEIP); (* return address to calling procedure *)
FI;
CPL
<
CodeSegment(DPL)
CS(RPL)
<
CPL
END;
SAME-PRIVILEGE:
IF CallGateSize = 32
THEN
IF stack does not have room for 8 bytes
THEN #SS(0); FI;
IF EIP not within code segment limit then #GP(0); FI;
CS:EIP
<
CallGate(CS:EIP) (* segment descriptor information also loaded *)
Push(oldCS:oldEIP); (* return address to calling procedure *)
ELSE (* CallGateSize = 16 *)
IF stack does not have room for parameters plus 4 bytes
THEN #SS(0); FI;
IF IP not within code segment limit THEN #GP(0); FI;
CS:IP
<
CallGate(CS:instruction pointer)
(* segment descriptor information also loaded *)
Push(oldCS:oldIP); (* return address to calling procedure *)
FI;
CS(RPL)
<
CPL
END;