File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,20 @@ pub fn sidt() -> DescriptorTablePointer {
7070
7171/// Load the task state register using the `ltr` instruction.
7272///
73+ /// Note that loading a TSS segment selector marks the corresponding TSS
74+ /// Descriptor in the GDT as "busy", preventing it from being loaded again
75+ /// (either on this CPU or another CPU). TSS structures (including Descriptors
76+ /// and Selectors) should generally be per-CPU. See
77+ /// [`tss_segment`](crate::structures::gdt::Descriptor::tss_segment)
78+ /// for more information.
79+ ///
80+ /// Calling `load_tss` with a busy TSS selector results in a `#GP` exception.
81+ ///
7382/// ## Safety
7483///
7584/// This function is unsafe because the caller must ensure that the given
76- /// `SegmentSelector` points to a valid TSS entry in the GDT and that loading
77- /// this TSS is safe .
85+ /// `SegmentSelector` points to a valid TSS entry in the GDT and that the
86+ /// corresponding data in the TSS is valid .
7887#[ inline]
7988pub unsafe fn load_tss ( sel : SegmentSelector ) {
8089 unsafe {
Original file line number Diff line number Diff line change @@ -312,6 +312,13 @@ impl Descriptor {
312312 }
313313
314314 /// Creates a TSS system descriptor for the given TSS.
315+ ///
316+ /// While it is possible to create multiple Descriptors that point to the
317+ /// same TSS, this generally isn't recommended, as the TSS usually contains
318+ /// per-CPU information such as the RSP and IST pointers. Instead, there
319+ /// should be exactly one TSS and one corresponding TSS Descriptor per CPU.
320+ /// Then, each of these descriptors should be placed in a GDT (which can
321+ /// either be global or per-CPU).
315322 #[ inline]
316323 pub fn tss_segment ( tss : & ' static TaskStateSegment ) -> Descriptor {
317324 use self :: DescriptorFlags as Flags ;
You can’t perform that action at this time.
0 commit comments