ia-32_instruction-set-ref_a-m

Pointer return code segment selector and eflags image

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: ; FI; EIP Pop(); EIP EIP AND 0000FFFFH; CS Pop(); (* 16-bit pop *) EFLAGS[15:0] Pop(); (* IOPL in EFLAGS not modified by pop *) FI; ELSE #GP(0); (* Trap to virtual-8086 monitor: PE FI; END; RETURN-TO-VIRTUAL-8086-MODE: (* Interrupted procedure was in virtual-8086 mode: PE = 1, VM IF top 24 bytes of stack are not within stack segment limits THEN #SS(0); FI; IF instruction pointer not within code segment limits THEN #GP(0); FI; CS tempCS; EIP tempEIP; EFLAGS tempEFLAGS; TempESP Pop(); TempSS Pop(); ES Pop(); (* Pop 2 words; throw away high-order word *) DS Pop(); (* Pop 2 words; throw away high-order word *) FS Pop(); (* Pop 2 words; throw away high-order word *) GS Pop(); (* Pop 2 words; throw away high-order word *) SS:ESP TempSS:TempESP; CPL 3; (* Resume execution in Virtual-8086 mode *) END; TASK-RETURN: (* PE = 1, VM = 0, NT = 1 *) Read segment selector in link field of current TSS; IF local/global bit is set to local or index not within GDT limits THEN #TS (TSS selector); FI; Access TSS for task specified in link field of current TSS; IF TSS descriptor type is not TSS or if the TSS is marked not busy THEN #TS (TSS selector); FI; IF TSS not present THEN #NP(TSS selector); FI; = 1, VM = 1, IOPL < 3 *) = 1 in flag image *) 3-488 Vol. 2 INSTRUCTION SET REFERENCE, A-M SWITCH-TASKS (without nesting) to TSS specified in link field of current TSS; Mark the task just abandoned as NOT BUSY; IF EIP is not within code segment limit THEN #GP(0); FI; END; PROTECTED-MODE-RETURN: (* PE = 1, VM = 0 in flags image *) IF return code segment selector is NULL THEN GP(0); FI; IF return code segment selector addresses descriptor beyond descriptor table limit THEN GP(selector); FI; Read segment descriptor pointed to by the return code segment selector; IF return code segment descriptor is not a code segment THEN #GP(selector); FI; IF return code segment selector RPL < CPL THEN #GP(selector); FI; IF return code segment descriptor is conforming and return code segment DPL > return code segment selector RPL THEN #GP(selector); FI; IF return code segment descriptor is not present THEN #NP(selector); FI; IF return code segment selector RPL > CPL THEN GOTO RETURN-OUTER-PRIVILEGE-LEVEL; ELSE GOTO RETURN-TO-SAME-PRIVILEGE-LEVEL; FI; END; RETURN-TO-SAME-PRIVILEGE-LEVEL: (* PE = 1, VM = 0 in flags image, RPL = CPL *) IF new mode 64-Bit Mode THEN IF tempEIP is not within code segment limits THEN #GP(0); FI; EIP tempEIP; ELSE (* new mode = 64-bit mode *) IF tempRIP is non-canonical THEN #GP(0); FI; RIP tempRIP; FI; CS tempCS; (* Segment descriptor information also loaded *) EFLAGS (CF, PF, AF, ZF, SF, TF, DF, OF, NT) tempEFLAGS; IF OperandSize = 32 or OperandSize = 64 THEN EFLAGS(RF, AC, ID) tempEFLAGS; FI; IF CPL IOPL THEN EFLAGS(IF) tempEFLAGS; FI; Vol. 2 3-489 INSTRUCTION SET REFERENCE, A-M IF CPL = 0 THEN EFLAGS(IOPL) tempEFLAGS; IF OperandSize = 32 THEN EFLAGS(VM, VIF, VIP) tempEFLAGS; FI; IF OperandSize = 64 THEN EFLAGS( VIF, VIP) tempEFLAGS; FI; FI; END; RETURN-TO-O...
View Full Document

This note was uploaded on 10/01/2013 for the course CPE 103 taught by Professor Watlins during the Winter '11 term at Mississippi State.

Ask a homework question - tutors are online