ia-32_instruction-set-ref_a-m

Segment descriptor information also loaded csrpl cpl

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: limit THEN #TS(current TSS selector); FI; newSS TSSstackAddress + 4; newESP stack address; ELSE IF current TSS is 16-bit TSS THEN TSSstackAddress new code segment (DPL 4) + 2; IF (TSSstackAddress + 4) > TSS limit THEN #TS(current TSS selector); FI; newESP TSSstackAddress; newSS TSSstackAddress + 2; ELSE (* TSS is 64-bit *) TSSstackAddress new code segment (DPL 8) + 4; IF (TSSstackAddress + 8) > TSS limit THEN #TS(current TSS selector); FI; newESP TSSstackAddress; newSS NULL; FI; FI; IF IA32_EFER.LMA = 0 and stack segment selector = NULL THEN #TS(stack segment selector); FI; Read code segment descriptor; IF IA32_EFER.LMA = 0 and (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 IA32_EFER.LMA = 0 and stack segment not present THEN #SS(SS selector); FI; Vol. 2 3-97 INSTRUCTION SET REFERENCE, A-M 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 *) 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 procedure's stack, temp) Push(oldCS:oldEIP); (* Return address to calling procedure *) ELSE IF CallGateSize = 16 THEN IF stack does not have room for parameters plus 8 bytes THEN #SS(SS selector); FI; IF (CallGate(InstructionPointer) AND FFFFH) not in 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 procedure's stack, temp) Push(oldCS:oldEIP); (* Return address to calling procedure *) ELSE (* CallGateSize = 64 *) IF pushing 32 bytes on the stack touches non-canonical addresses THEN #SS(SS selector); FI; IF (CallGate(InstructionPointer) is non-canonical) THEN #GP(0); FI; SS newSS; (* New SS is NULL) RSP newESP; CS:IP CallGate(CS:InstructionPointer); (* Segment descriptor information also loaded *) Push(oldSS:oldESP); (* From calling procedure *) Push(oldCS:oldEIP); (* Return address to calling procedure *) FI; 3-98 Vol. 2 INSTRUCTION SET REFERENCE, A-M 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 CallGate(InstructionPointer) 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 If CallGateSize = 16 THEN IF stack does not have room for 4 bytes THEN #SS(0); FI; IF CallGate(Instru...
View Full Document

Ask a homework question - tutors are online