x86_64::instructions::tables

Function load_tss

Source
pub unsafe fn load_tss(sel: SegmentSelector)
Expand description

Load the task state register using the ltr instruction.

Note that loading a TSS segment selector marks the corresponding TSS Descriptor in the GDT as “busy”, preventing it from being loaded again (either on this CPU or another CPU). TSS structures (including Descriptors and Selectors) should generally be per-CPU. See tss_segment for more information.

Calling load_tss with a busy TSS selector results in a #GP exception.

§Safety

This function is unsafe because the caller must ensure that the given SegmentSelector points to a valid TSS entry in the GDT and that the corresponding data in the TSS is valid.