Struct rstubs::arch::gdt::Descriptor
source · #[repr(transparent)]pub struct Descriptor(u64);
Expand description
Describes the structure of segment descriptors
A data structure that contains size, position, access rights, and purpose of any segment. Segment descriptors are used in both the GDT, as well as in LDTs.
- ISDMv3, 3.4.5; Segment Descriptors
- AAPMv2, 4.7 Legacy Segment Descriptors
Tuple Fields§
§0: u64
Implementations§
source§impl Descriptor
impl Descriptor
const LIMIT_LOW_BITS: usize = 16usize
const LIMIT_LOW_OFFSET: usize = 0usize
sourceconst fn with_limit_low(self, value: u32) -> Self
const fn with_limit_low(self, value: u32) -> Self
Least-significant bits of segment size (influenced by pages
!)
Bits: 0..16
sourceconst fn limit_low(&self) -> u32
const fn limit_low(&self) -> u32
Least-significant bits of segment size (influenced by pages
!)
Bits: 0..16
sourcefn set_limit_low(&mut self, value: u32)
fn set_limit_low(&mut self, value: u32)
Least-significant bits of segment size (influenced by pages
!)
Bits: 0..16
const BASE_LOW_BITS: usize = 24usize
const BASE_LOW_OFFSET: usize = 16usize
sourceconst fn with_base_low(self, value: u32) -> Self
const fn with_base_low(self, value: u32) -> Self
Least-significant bits of base address
Bits: 16..40
sourcefn set_base_low(&mut self, value: u32)
fn set_base_low(&mut self, value: u32)
Least-significant bits of base address
Bits: 16..40
const KIND_BITS: usize = 4usize
const KIND_OFFSET: usize = 40usize
sourcepub const fn with_kind(self, value: u8) -> Self
pub const fn with_kind(self, value: u8) -> Self
Meaning of those 4 bits depends on kind_code_data
below
Bits: 40..44
sourcepub const fn kind(&self) -> u8
pub const fn kind(&self) -> u8
Meaning of those 4 bits depends on kind_code_data
below
Bits: 40..44
sourcepub fn set_kind(&mut self, value: u8)
pub fn set_kind(&mut self, value: u8)
Meaning of those 4 bits depends on kind_code_data
below
Bits: 40..44
const DESCRIPTOR_KIND_BITS: usize = 1usize
const DESCRIPTOR_KIND_OFFSET: usize = 44usize
sourcepub const fn with_descriptor_kind(self, value: bool) -> Self
pub const fn with_descriptor_kind(self, value: bool) -> Self
Descriptor type (influences the meaning of the 3 bits above)
Bits: 44..45
sourcepub const fn descriptor_kind(&self) -> bool
pub const fn descriptor_kind(&self) -> bool
Descriptor type (influences the meaning of the 3 bits above)
Bits: 44..45
sourcepub fn set_descriptor_kind(&mut self, value: bool)
pub fn set_descriptor_kind(&mut self, value: bool)
Descriptor type (influences the meaning of the 3 bits above)
Bits: 44..45
const RING_BITS: usize = 2usize
const RING_OFFSET: usize = 45usize
const PRESENT_BITS: usize = 1usize
const PRESENT_OFFSET: usize = 47usize
sourcepub const fn with_present(self, value: bool) -> Self
pub const fn with_present(self, value: bool) -> Self
Entry is valid iff set to true
Bits: 47..48
sourcepub fn set_present(&mut self, value: bool)
pub fn set_present(&mut self, value: bool)
Entry is valid iff set to true
Bits: 47..48
const LIMIT_HIGH_BITS: usize = 4usize
const LIMIT_HIGH_OFFSET: usize = 48usize
sourceconst fn with_limit_high(self, value: u32) -> Self
const fn with_limit_high(self, value: u32) -> Self
Most-significant bits of segment size
Bits: 48..52
sourceconst fn limit_high(&self) -> u32
const fn limit_high(&self) -> u32
Most-significant bits of segment size
Bits: 48..52
sourcefn set_limit_high(&mut self, value: u32)
fn set_limit_high(&mut self, value: u32)
Most-significant bits of segment size
Bits: 48..52
const AVAILABLE_BITS: usize = 1usize
const AVAILABLE_OFFSET: usize = 52usize
sourcepub const fn with_available(self, value: bool) -> Self
pub const fn with_available(self, value: bool) -> Self
Bit which can be used for other purposes (in software)
Bits: 52..53
sourcepub const fn available(&self) -> bool
pub const fn available(&self) -> bool
Bit which can be used for other purposes (in software)
Bits: 52..53
sourcepub fn set_available(&mut self, value: bool)
pub fn set_available(&mut self, value: bool)
Bit which can be used for other purposes (in software)
Bits: 52..53
const CUSTOM_BITS: usize = 2usize
const CUSTOM_OFFSET: usize = 53usize
sourcepub const fn with_custom(self, value: u8) -> Self
pub const fn with_custom(self, value: u8) -> Self
Meaning of those 2 bits relate to descriptor_kind
and kind
Bits: 53..55
sourcepub const fn custom(&self) -> u8
pub const fn custom(&self) -> u8
Meaning of those 2 bits relate to descriptor_kind
and kind
Bits: 53..55
sourcepub fn set_custom(&mut self, value: u8)
pub fn set_custom(&mut self, value: u8)
Meaning of those 2 bits relate to descriptor_kind
and kind
Bits: 53..55
const PAGES_BITS: usize = 1usize
const PAGES_OFFSET: usize = 55usize
sourcepub const fn with_pages(self, value: bool) -> Self
pub const fn with_pages(self, value: bool) -> Self
Uses page granularity for the segment limit (instead of bytes)
Bits: 55..56
sourcepub const fn pages(&self) -> bool
pub const fn pages(&self) -> bool
Uses page granularity for the segment limit (instead of bytes)
Bits: 55..56
sourcepub fn set_pages(&mut self, value: bool)
pub fn set_pages(&mut self, value: bool)
Uses page granularity for the segment limit (instead of bytes)
Bits: 55..56
const BASE_HIGH_BITS: usize = 8usize
const BASE_HIGH_OFFSET: usize = 56usize
sourceconst fn with_base_high(self, value: u8) -> Self
const fn with_base_high(self, value: u8) -> Self
most-significant bits of base address
Bits: 56..64
sourcefn set_base_high(&mut self, value: u8)
fn set_base_high(&mut self, value: u8)
most-significant bits of base address
Bits: 56..64
source§impl Descriptor
impl Descriptor
sourcepub const fn segment(
memory: RangeInclusive<u32>,
code: bool,
user: bool
) -> Descriptor
pub const fn segment( memory: RangeInclusive<u32>, code: bool, user: bool ) -> Descriptor
Create a code/data segment descriptor
sourcepub fn tss(tss: &TaskStateSegment) -> Descriptor
pub fn tss(tss: &TaskStateSegment) -> Descriptor
Creates a new task state segment descriptor for the Global Descriptor Table.
sourcepub const fn with_limit(self, v: u32) -> Self
pub const fn with_limit(self, v: u32) -> Self
Segment size
Trait Implementations§
source§impl Clone for Descriptor
impl Clone for Descriptor
source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more