Task state segment

Posted By on October 20, 2014


Download PDF
virtual 8086 mode of operation of 80386
Explain briefly in steps what happens when an interrupt occurs - 8086

The task state segment (TSS) is a special segment  which holds information about a task. It is used by the operating system kernel for task management. Specifically, the following information is stored in the TSS:

  • Processor register state
  • I/O port permissions
  • Inner-level stack pointers
  • Previous TSS link

 

Location of the TSS::

 

The TSS may reside anywhere in memory. A special segment register called the task register (TR) holds a segment selector that points to a valid TSS segment descriptor which resides in the GDT (a TSS descriptor may not reside in the LDT). Therefore, to use a TSS the following must be done by the operating system kernel:

  1. Create a TSS descriptor entry in the GDT
  2. Load the TR with a segment selector for that segment
  3. Add information to the TSS in memory as needed

For security purposes, the TSS should be placed in memory that is accessible only to the kernel.

 

Task register::

The TR register is a 16-bit register which holds a segment selector for the TSS. It may be loaded through the LTR instruction. LTR is a privileged instruction and acts in a manner similar to other segment register loads. The task register has two parts: a portion visible and accessible by the programmer and an invisible one that is automatically loaded from the TSS descriptor

Register states::

The TSS may contain saved values of all the x86 registers. This is used for task switching. The operating system may load the TSS with the values of the registers that the new task needs and after executing a hardware task switch (such as with an IRET instruction) the x86 CPU will load the saved values from the TSS into the appropriate registers. Note that some modern operating systems such as Windows and Linux do not use these fields in the TSS as they implement software task switching.

virtual 8086 mode of operation of 80386
Explain briefly in steps what happens when an interrupt occurs - 8086

Download PDF

Posted by Akash Kurup

Founder and C.E.O, World4Engineers Educationist and Entrepreneur by passion. Orator and blogger by hobby

Website: http://world4engineers.com