Skip to main content

Segment

Trait Segment 

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 SegmentSelectors, 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§

fn get_reg() -> SegmentSelector

Returns the current value of the segment register.

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".

Implementors§

§

impl Segment for CS

§

impl Segment for DS

§

impl Segment for ES

§

impl Segment for FS

§

impl Segment for GS

§

impl Segment for SS