32-bit multitasking task segment update

136 views Asked by At

I was reading the page at https://wiki.osdev.org/Task_State_Segment

As what I understand, when jumping or calling a task descriptor it will « automatically » switch ring and registers corresponding to the according TSS segment linked with this task descriptor.

But when switching tasks, let’s say ring 3 to other ring 3, are registers automatically saved in the actual TSS? (Loaded in tr register).

Because on this osdev page (link above) it says that the registers are not saved, but if not how a task can update it’s TSS by itself? It would create huge security issues.

(I know hardware switching is outdated but I still want to understand it’s mechanics.)

1

There are 1 answers

0
mevets On

That page isn't really about osdev; it is about what linux uses. Linux doesn't switch tasks, so it only concerns itself about privity switching within a task.

When you call or jmp to a selector that is a task, or task gate, your registers will be saved into the task segment identified by the current tr register; then tr will be switched to the target selector, and the registers will be loaded from this task segment.