Intel ARCHITECTURE IA-32 User Manual Page 221

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 220
Vol. 3A 5-45
INTERRUPT AND EXCEPTION HANDLING
Interrupt 12—Stack Fault Exception (#SS)
Exception Class Fault.
Description
Indicates that one of the following stack related conditions was detected:
A limit violation is detected during an operation that refers to the SS register. Operations
that can cause a limit violation include stack-oriented instructions such as POP, PUSH,
CALL, RET, IRET, ENTER, and LEAVE, as well as other memory references which
implicitly or explicitly use the SS register (for example, MOV AX, [BP+6] or MOV AX,
SS:[EAX+6]). The ENTER instruction generates this exception when there is not enough
stack space for allocating local variables.
A not-present stack segment is detected when attempting to load the SS register. This
violation can occur during the execution of a task switch, a CALL instruction to a different
privilege level, a return to a different privilege level, an LSS instruction, or a MOV or POP
instruction to the SS register.
Recovery from this fault is possible by either extending the limit of the stack segment (in the
case of a limit violation) or loading the missing stack segment into memory (in the case of a not-
present violation.
Exception Error Code
If the exception is caused by a not-present stack segment or by overflow of the new stack during
an inter-privilege-level call, the error code contains a segment selector for the segment that
caused the exception. Here, the exception handler can test the present flag in the segment
descriptor pointed to by the segment selector to determine the cause of the exception. For a
normal limit violation (on a stack segment already in use) the error code is set to 0.
Saved Instruction Pointer
The saved contents of CS and EIP registers generally point to the instruction that generated the
exception. However, when the exception results from attempting to load a not-present stack
segment during a task switch, the CS and EIP registers point to the first instruction of the new
task.
Program State Change
A program-state change does not generally accompany a stack-fault exception, because the
instruction that generated the fault is not executed. Here, the instruction can be restarted after
the exception handler has corrected the stack fault condition.
If a stack fault occurs during a task switch, it occurs after the commit-to-new-task point (see
Section 6.3, “Task Switching”). Here, the processor loads all the state information from the new
TSS (without performing any additional limit, present, or type checks) before it generates the
Page view 220
1 2 ... 216 217 218 219 220 221 222 223 224 225 226 ... 635 636

Comments to this Manuals

No comments