pub trait Segment {
// Required methods
fn get_reg() -> SegmentSelector;
unsafe fn set_reg(sel: SegmentSelector);
}
Expand description
An x86 segment
Segment registers on x86 are 16-bit SegmentSelector
s, which index into
the GlobalDescriptorTable
. The corresponding GDT entry is used to
configure the segment itself. Note that most segmentation functionality is
disabled in 64-bit mode. See the individual segments for more information.
Required Methods§
Sourcefn get_reg() -> SegmentSelector
fn get_reg() -> SegmentSelector
Returns the current value of the segment register.
Sourceunsafe fn set_reg(sel: SegmentSelector)
unsafe fn set_reg(sel: SegmentSelector)
Reload the segment register. Depending on the segment, this may also reconfigure the corresponding segment.
§Safety
This function is unsafe because the caller must ensure that sel
is a valid segment descriptor, and that reconfiguring the segment will
not cause undefined behavior.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.