#[repr(packed(1))]pub struct Descriptor {
pub lower: u32,
pub upper: u32,
}
Expand description
Entry for IDT, GDT or LDT. Provides size and location of a segment.
See Intel 3a, Section 3.4.5 “Segment Descriptors”, and Section 3.5.2
Fields§
§lower: u32
§upper: u32
Implementations§
Source§impl Descriptor
impl Descriptor
pub const NULL: Descriptor
pub fn as_u64(&self) -> u64
Sourcepub fn set_base_limit(&mut self, base: u32, limit: u32)
pub fn set_base_limit(&mut self, base: u32, limit: u32)
Create a new segment, TSS or LDT descriptor by setting the three base and two limit fields.
Sourcepub fn set_selector_offset(&mut self, selector: SegmentSelector, offset: u32)
pub fn set_selector_offset(&mut self, selector: SegmentSelector, offset: u32)
Creates a new descriptor with selector and offset (for IDT Gate descriptors, e.g. Trap, Interrupts and Task gates)
Sourcepub fn set_type(&mut self, typ: u8)
pub fn set_type(&mut self, typ: u8)
Set the type of the descriptor (bits 8-11). Indicates the segment or gate type and specifies the kinds of access that can be made to the segment and the direction of growth. The interpretation of this field depends on whether the descriptor type flag specifies an application (code or data) descriptor or a system descriptor.
Sourcepub fn set_s(&mut self)
pub fn set_s(&mut self)
Specifies whether the segment descriptor is for a system segment (S flag is clear) or a code or data segment (S flag is set).
Sourcepub fn set_dpl(&mut self, ring: Ring)
pub fn set_dpl(&mut self, ring: Ring)
Specifies the privilege level of the segment. The DPL is used to control access to the segment.
Sourcepub fn set_p(&mut self)
pub fn set_p(&mut self)
Set Present bit. Indicates whether the segment is present in memory (set) or not present (clear). If this flag is clear, the processor generates a segment-not-present exception (#NP) when a segment selector that points to the segment descriptor is loaded into a segment register.
Sourcepub fn set_l(&mut self)
pub fn set_l(&mut self)
Set L In IA-32e mode, bit 21 of the second doubleword of the segment descriptor indicates whether a code segment contains native 64-bit code. A value of 1 indicates instructions in this code segment are executed in 64-bit mode. A value of 0 indicates the instructions in this code segment are executed in compatibility mode. If L-bit is set, then D-bit must be cleared.
Trait Implementations§
Source§impl BuildDescriptor<Descriptor> for DescriptorBuilder
impl BuildDescriptor<Descriptor> for DescriptorBuilder
fn finish(&self) -> Descriptor
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more