13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

HANDLING EXCEPTION CONDITIONSThe processor pushes an error code on the stack of the exception handler. If the exception is due to anot-present stack segment or to overflow of the new stack during an interlevel CALL, the error codecontains a selector to the segment in question (the exception handler can test the present bit in thedescriptor to determine which exception has occurred); otherwise the error code is null.The instruction that causes a stack fault is usually restart able. Execution of an IRET by the exceptionhandler causes the processor to execute the faulting instruction again. The one case that is not restartableis a PUSHA or POPA intruction that attempts to wrap around the 64K boundaries of a stacksegment. This condition is identified by one of the values FFFEH,FFFFH, OOOOH, or OOOlH in thesaved SP.When the processor detects a stack fault while loading SS during a task switch, the exception occursin the new task, and the return pointer has the value that the IP field of the new TSS held at the timethe task switch began.When stack overflow causes the exception, the stack fault handler can increase the size of the stacksegment (up toa maximum of 64K) and permit the faulting task to continue. When the exception isdue to a stack segment not being present, recovery action resembles that of the "not present" faulthandler.Interrupt 13-General Protection Exception (GP)All protection violations that do not cause another exception cause a general protection exception. Thisincludes (but is not limited to)• Exceeding segment limit when using DS, ES, orCS• Exceeding segment limit when referencing a descriptor table• Jumping to a data segment• Writing into a read-only segment or an executable segment• Reading from an execute-only segment• Loading the SS register with a read-only descriptor (unless the selector comes from the TSS duringa task switch, in which case a TSS exception occurs)• Loading DS, ES, or SS with the descriptor of a system segment• Loading DS, ES, or SS with the descriptor of an executable segment• Loading CS (by means of a CALL, JMP, or interrupt) with the descriptor of a data segment• Accessing memory via DS or ES when it contains a null selector• Switching to a busy task• Violating privilege rulesThe processor pushes an error code onto the exception handler's stack. If loading a descriptor causedthe exception, the error code contains a selector to the descriptor; otherwise the error code is null.The return pointer points to the beginning of the faulting instruction. Recovery may be possible, butbecause programming errors cause most of the conditions leading to a general protection exception,recovery may not be worth the trouble required to identify the cause.A string instruction (any variant of INS, OUTS, MOVS, STOS, SCAS, or CMPS) with a repeat prefix(REP, REPE, or REPN E) is not restart able if it causes a segment limit violation. Check whether SIor D I is ncar the scgmen I limit.7-7 121960-001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!