File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -70,11 +70,18 @@ pub fn sidt() -> DescriptorTablePointer {
70
70
71
71
/// Load the task state register using the `ltr` instruction.
72
72
///
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
+ ///
73
80
/// ## Safety
74
81
///
75
82
/// 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 .
83
+ /// `SegmentSelector` points to a valid TSS entry in the GDT, that is entry is
84
+ /// not busy, and that the corresponding data in the TSS is valid .
78
85
#[ inline]
79
86
pub unsafe fn load_tss ( sel : SegmentSelector ) {
80
87
unsafe {
Original file line number Diff line number Diff line change @@ -312,6 +312,13 @@ impl Descriptor {
312
312
}
313
313
314
314
/// 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).
315
322
#[ inline]
316
323
pub fn tss_segment ( tss : & ' static TaskStateSegment ) -> Descriptor {
317
324
use self :: DescriptorFlags as Flags ;
You can’t perform that action at this time.
0 commit comments