Vol. 3A 6-17
TASK MANAGEMENT
Table 6-2 shows the busy flag (in the TSS segment descriptor), the NT flag, the previous tasklink field, and TS flag (in control register CR0) during a task switch.The NT flag may be modified by software executing at any privilege level. It is possible for aprogram to set the NT flag and execute an IRET instruction. This might randomly invoke thetask specified in the previous link field of the current task's TSS. To keep such spurious taskswitches from succeeding, the operating system should initialize the previous task link field inevery TSS that it creates to 0.

Figure 6-8. Nested Tasks

Table 6-2. Effect of a Task Switch on Busy Flag, NT Flag,

Previous Task Link Field, and TS Flag

Flag or Field Effect of JMP
instruction
Effect of CALL
Instruction or
Interrupt Effect of IRET
Instruction
Busy (B) flag of new
task. Flag is set. Must have
been clear before. Flag is set. Must have
been clear before. No change. Must have
been set.
Busy flag of old task. Flag is cleared. No change. Flag is
currently set. Flag is cleared.
NT flag of new task. Set to value from TSS of
new task. Flag is set. Set to value from TSS of
new task.
NT flag of old task. No change. No change. Flag is cleared.
Previous task link field of
new task. No change. Loaded with selector
for old task’s TSS. No change.
Previous task link field of
old task. No change. No change. No change.
TS flag in control
register CR0. Flag is set. Flag is set. Flag is set.
Top Level
Task
NT=0
Previous
TSS
Nested
Task
NT=1
TSS
More Deeply
Nested Task
NT=1
TSS
Currently Executing
Task
NT=1
EFLAGS
Task Register
Task Link Previous
Task Link Previous
Task Link