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. Note that during a hardware task switch, certain fields of the
old TSS are updated with the CPU's current register contents before the values from the
new TSS are read. Thus some TSS fields are read/write, while others are read-only: •
Read/Write fields: read and written during a hardware task switch. • All general-purpose registers (EAX, EBX, ECX, EDX, ESI, EDI, EBP, ESP) • All segment registers (CS, DS, ES, FS, GS, SS) • Current execution state (EIP, EFlags) • The Link field in the
new TSS, if the task switch was due to a CALL or INT rather than a JMP. •
Read-only fields: read only when required, as indicated. • Control Register 3 (CR3), also known as the Page Directory Base Register (PDBR). • : Read during a hardware task switch. • The Local Descriptor Table register (LDTR) • : Read during a hardware task switch. • The three privilege-level stack pairs (SS0:ESP0, SS1:ESP1, SS2:ESP2) • : Read during an inter-level CALL or INT to establish a new stack. • The IO Port Bitmap pointer (IOPB) and the I/O Port Bitmap itself • : Read during an IN, OUT, INS or OUTS instruction if CPL > IOPL to confirm the instruction is legal (see
I/O port permissions below). • debug trap (T) • SSP The PDBR field is in fact the very first one read out of the new TSS: since a hardware task switch can also switch to a completely different
page table mapping, all the other fields (especially the LDTR) are relative to the new mapping. ==I/O port permissions==