Intel IA-32 User Manual
Page 257
Vol. 3A 6-15
TASK MANAGEMENT
When switching tasks, the privilege level of the new task does not inherit its privilege level from
the suspended task. The new task begins executing at the privilege level specified in the CPL
field of the CS register, which is loaded from the TSS. Because tasks are isolated by their sepa-
rate address spaces and TSSs and because privilege rules control access to a TSS, software does
not need to perform explicit privilege checks on a task switch.
Table 6-1 shows the exception conditions that the processor checks for when switching tasks. It
also shows the exception that is generated for each check if an error is detected and the segment
that the error code references. (The order of the checks in the table is the order used in the P6
family processors. The exact order is model specific and may be different for other IA-32
processors.) Exception handlers designed to handle these exceptions may be subject to recursive
calls if they attempt to reload the segment selector that generated the exception. The cause of
the exception (or the first of multiple causes) should be fixed before reloading the selector.
Table 6-1. Exception Conditions Checked During a Task Switch
Condition Checked
Exception
1
Error Code
Reference
2
Segment selector for a TSS descriptor references
the GDT and is within the limits of the table.
#GP
#TS (for IRET)
New Task’s TSS
TSS descriptor is present in memory.
#NP
New Task’s TSS
TSS descriptor is not busy (for task switch initiated by a
call, interrupt, or exception).
#GP (for JMP, CALL,
INT)
Task’s back-link TSS
TSS descriptor is not busy (for task switch initiated by
an IRET instruction).
#TS (for IRET)
New Task’s TSS
TSS segment limit greater than or equal to 108 (for 32-
bit TSS) or 44 (for 16-bit TSS).
#TS
New Task’s TSS
Registers are loaded from the values in the TSS.
LDT segment selector of new task is valid
3
.
#TS
New Task’s LDT
Code segment DPL matches segment selector RPL.
#TS
New Code Segment
SS segment selector is valid
2
.
#TS
New Stack Segment
Stack segment is present in memory.
#SF
New Stack Segment
Stack segment DPL matches CPL.
#TS
New stack segment
LDT of new task is present in memory.
#TS
New Task’s LDT
CS segment selector is valid
3
.
#TS
New Code Segment
Code segment is present in memory.
#NP
New Code Segment
Stack segment DPL matches selector RPL.
#TS
New Stack Segment
DS, ES, FS, and GS segment selectors are valid
3
.
#TS
New Data Segment
DS, ES, FS, and GS segments are readable.
#TS
New Data Segment