6-32 Vol. 3A
INTERRUPT AND EXCEPTION HANDLING
This exception can generated either in the context of the original task or in the context of the new task (see Section
7.3, “Task Switching”). Until the processor has completely verified the presence of the new TSS, the exception is
generated in the context of the original task. Once the existence of the new TSS is verified, the task switch is
considered complete. Any invalid-TSS conditions detected after this point are handled in the context of the new
task. (A task switch is considered complete when the task register is loaded with the segment selector for the new
TSS and, if the switch is due to a procedure call or interrupt, the previous task link field of the new TSS references
the old TSS.)
The invalid-TSS handler must be a task called using a task gate. Handling this exception inside the faulting TSS
context is not recommended because the processor state may not be consistent.
Exception Error Code
An error code containing the segment selector index for the segment descriptor that caused the violation is pushed
onto the stack of the exception handler. If the EXT flag is set, it indicates that the exception was caused by an event
external to the currently running program (for example, if an external interrupt handler using a task gate
attempted a task switch to an invalid TSS).
Saved Instruction Pointer
If the exception condition was detected before the task switch was carried out, the saved contents of CS and EIP
registers point to the instruction that invoked the task switch. If the exception condition was detected after the task
switch was carried out, the saved contents of CS and EIP registers point to the first instruction of the new task.
Program State Change
The ability of the invalid-TSS handler to recover from the fault depends on the error condition than causes the fault.
See Section 7.3, “Task Switching,” for more information on the task switch process and the possible recovery
actions that can be taken.
If an invalid TSS exception occurs during a task switch, it can occur before or after the commit-to-new-task point.
If it occurs before the commit point, no program state change occurs. If it occurs after the commit point (when the
segment descriptor information for the new segment selectors have been loaded in the segment registers), the
processor will load all the state information from the new TSS before it generates the exception. During a task
switch, the processor first loads all the segment registers with segment selectors from the TSS, then checks their
contents for validity. If an invalid TSS exception is discovered, the remaining segment registers are loaded but not
checked for validity and therefore may not be usable for referencing memory. The invalid TSS handler should not
rely on being able to use the segment selectors found in the CS, SS, DS, ES, FS, and GS registers without causing
another exception. The exception handler should load all segment registers before trying to resume the new task;
otherwise, general-protection exceptions (#GP) may result later under conditions that make diagnosis more diffi-
Data segment selector index
The data segment descriptor is a nonconforming code type and CPL > DPL.
TSS segment selector index
The TSS segment selector is NULL for LTR.
TSS segment selector index
The TSS segment selector has the TI bit set for LTR.
TSS segment selector index
The TSS segment descriptor/upper descriptor is beyond the GDT segment limit.
TSS segment selector index
The TSS segment descriptor is not an available TSS type.
TSS segment selector index
The TSS segment descriptor is an available 286 TSS type in IA-32e mode.
TSS segment selector index
The TSS segment upper descriptor is not the correct type.
TSS segment selector index
The TSS segment descriptor contains a non-canonical base.
TSS segment selector index
There is a limit violation in attempting to load SS selector or ESP from a TSS on a call or
exception which changes privilege levels in legacy mode.
TSS segment selector index
There is a limit violation or canonical fault in attempting to load RSP or IST from a TSS on a
call or exception which changes privilege levels in IA-32e mode.
Table 6-6. Invalid TSS Conditions (Contd.)
Error Code Index
Invalid Condition