MP - Unit 5
MP - Unit 5
MULTITASKING and
Virtual Mode
Time
⚫Figure (Next):
the path by which the processor accesses
the current TSS
TASK REGISTER
⚫The task register (TR) is used to
find the current TSS.
⚫The task register has :
• a visible part (i.e., a part which can be
read and changed by software),
• an invisible part (i.e., a part maintained
by the processor and inaccessible to
software).
⚫The selector in the visible portion indexes
to a TSS descriptor in the GDT.
⚫ The processor uses the invisible portion
of the TR register to retain the base and
limit values from the TSS descriptor.
⚫ Keeping these values in a register makes
execution of the task more efficient,
because the processor does not need to
fetch these values from memory to
reference the TSS of the current task.
⚫The LTR and STR instructions are used to
modify and read the visible portion of the task
register.
2.The new TSS descriptor must have its present bit set
and have a valid limit field.
5.The state of the new task is loaded from its TSS and
Step 1
⚫ Checking that the current task is allowed to switch to the
designated task.
⚫ Data-access privilege rules apply in the case of JMP or CALL
instructions.
⚫ The DPL of the TSS descriptor or task gate must be less than
or equal to the maximum of CPL and the RPL of the gate
selector.
⚫ Exceptions, interrupts, and IRETs are permitted to switch
tasks regardless of the DPL of the target task gate or TSS
descriptor.
⚫ The DPL, CPL, and RPL values are compared before any
further processing takes place.
⚫ Interrupts and exceptions do not force protection
checking.
Step 2
⚫Checking that the TSS descriptor of the new
task is marked present and has a valid limit.
⚫Any errors up to this point occur in the
context of the outgoing task.
⚫Errors are restartable and can be handled in
a way that is transparent to applications
procedures.
Step 3
⚫ Saving the state of the current task.
⚫This involves copying the contents of all
processor registers into the TSS for the current
task.
⚫ The processor finds the base address of the current
TSS cached in the task register.
⚫ It copies the registers into the current TSS (EAX,
ECX, EDX, EBX, ESP, EBP, ESI, EDI, ES, CS, SS, DS,
FS, GS, and the flag register).
⚫ The EIP field of the TSS points to the instruction
after the one that caused the task switch.
Step 4
⚫Loading the task register with :
✔the selector of the incoming task's TSS
descriptor,
✔marking the incoming task's TSS descriptor
as busy, and
✔setting the TS (task switched) bit of the MSW,
as is the busy bit in the new TSS descriptor.