- A stack switch occurs during a task switch from a **lesser privilege level to a higher** privilege level
- E.g. \textcolor{mygreen}{ring 3} $\rightarrow$ \textcolor{myred}{ring 0}: `ss` and `esp` are loaded from the current task's `TSS.ss0` and `TSS.esp0` values
- Typically happens when:
- a task (user mode) performs a system call (\textcolor{mygreen}{ring 3} $\rightarrow$ \textcolor{myred}{ring 0})
- user code (\textcolor{mygreen}{ring 3}) is interrupted by a hardware interrupt or a processor exception
- A stack switch occurs during a task switch from a **lesser privilege level to a higher** privilege level
- E.g. \textcolor{mygreen}{ring 3} $\rightarrow$ \textcolor{myred}{ring 0}: `ss` and `esp` are loaded from the current task's `TSS.ss0` and `TSS.esp0` values
- Typically happens when:
- a task (user mode) performs a system call (\textcolor{mygreen}{ring 3} $\rightarrow$ \textcolor{myred}{ring 0})
- user code (\textcolor{mygreen}{ring 3}) is interrupted by a hardware interrupt or a processor exception