#[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
const BASE_LOW_BITS: usize = 24usize
const BASE_LOW_OFFSET: usize = 16usize
const KIND_BITS: usize = 4usize
const KIND_OFFSET: usize = 40usize
const DESCRIPTOR_KIND_BITS: usize = 1usize
const DESCRIPTOR_KIND_OFFSET: usize = 44usize
const RING_BITS: usize = 2usize
const RING_OFFSET: usize = 45usize
const PRESENT_BITS: usize = 1usize
const PRESENT_OFFSET: usize = 47usize
const LIMIT_HIGH_BITS: usize = 4usize
const LIMIT_HIGH_OFFSET: usize = 48usize
const AVAILABLE_BITS: usize = 1usize
const AVAILABLE_OFFSET: usize = 52usize
const CUSTOM_BITS: usize = 2usize
const CUSTOM_OFFSET: usize = 53usize
const PAGES_BITS: usize = 1usize
const PAGES_OFFSET: usize = 55usize
const BASE_HIGH_BITS: usize = 8usize
const BASE_HIGH_OFFSET: usize = 56usize
sourceconst fn limit_low(&self) -> u32
const fn limit_low(&self) -> u32
Least-significant bits of segment size (influenced by Self::pages
!)
Bits: 0..16
sourceconst fn with_limit_low_checked(self, value: u32) -> Result<Self, ()>
const fn with_limit_low_checked(self, value: u32) -> Result<Self, ()>
Least-significant bits of segment size (influenced by Self::pages
!)
Bits: 0..16
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 Self::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 Self::pages
!)
Bits: 0..16
sourcefn set_limit_low_checked(&mut self, value: u32) -> Result<(), ()>
fn set_limit_low_checked(&mut self, value: u32) -> Result<(), ()>
Least-significant bits of segment size (influenced by Self::pages
!)
Bits: 0..16
sourceconst fn with_base_low_checked(self, value: u32) -> Result<Self, ()>
const fn with_base_low_checked(self, value: u32) -> Result<Self, ()>
Least-significant bits of base address
Bits: 16..40
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
sourcefn set_base_low_checked(&mut self, value: u32) -> Result<(), ()>
fn set_base_low_checked(&mut self, value: u32) -> Result<(), ()>
Least-significant bits of base address
Bits: 16..40
sourcepub const fn kind(&self) -> u8
pub const fn kind(&self) -> u8
Type: defines which kind code/data/system descriptor this is.
This depends on Self::descriptor_kind
.
Bits: 40..44
sourcepub const fn with_kind_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_kind_checked(self, value: u8) -> Result<Self, ()>
Type: defines which kind code/data/system descriptor this is.
This depends on Self::descriptor_kind
.
Bits: 40..44
sourcepub const fn with_kind(self, value: u8) -> Self
pub const fn with_kind(self, value: u8) -> Self
Type: defines which kind code/data/system descriptor this is.
This depends on Self::descriptor_kind
.
Bits: 40..44
sourcepub fn set_kind(&mut self, value: u8)
pub fn set_kind(&mut self, value: u8)
Type: defines which kind code/data/system descriptor this is.
This depends on Self::descriptor_kind
.
Bits: 40..44
sourcepub fn set_kind_checked(&mut self, value: u8) -> Result<(), ()>
pub fn set_kind_checked(&mut self, value: u8) -> Result<(), ()>
Type: defines which kind code/data/system descriptor this is.
This depends on Self::descriptor_kind
.
Bits: 40..44
sourcepub const fn descriptor_kind(&self) -> bool
pub const fn descriptor_kind(&self) -> bool
Descriptor type: if true
code or data, else system
Bits: 44..45
sourcepub const fn with_descriptor_kind_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_descriptor_kind_checked(self, value: bool) -> Result<Self, ()>
Descriptor type: if true
code or data, else system
Bits: 44..45
sourcepub const fn with_descriptor_kind(self, value: bool) -> Self
pub const fn with_descriptor_kind(self, value: bool) -> Self
Descriptor type: if true
code or data, else system
Bits: 44..45
sourcepub fn set_descriptor_kind(&mut self, value: bool)
pub fn set_descriptor_kind(&mut self, value: bool)
Descriptor type: if true
code or data, else system
Bits: 44..45
sourcepub fn set_descriptor_kind_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_descriptor_kind_checked(&mut self, value: bool) -> Result<(), ()>
Descriptor type: if true
code or data, else system
Bits: 44..45
sourcepub const fn with_ring_checked(self, value: Ring) -> Result<Self, ()>
pub const fn with_ring_checked(self, value: Ring) -> Result<Self, ()>
Ring for this segment
Bits: 45..47
sourcepub fn set_ring_checked(&mut self, value: Ring) -> Result<(), ()>
pub fn set_ring_checked(&mut self, value: Ring) -> Result<(), ()>
Ring for this segment
Bits: 45..47
sourcepub const fn with_present_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_present_checked(self, value: bool) -> Result<Self, ()>
Entry is ignored if set to false
Bits: 47..48
sourcepub const fn with_present(self, value: bool) -> Self
pub const fn with_present(self, value: bool) -> Self
Entry is ignored if set to false
Bits: 47..48
sourcepub fn set_present(&mut self, value: bool)
pub fn set_present(&mut self, value: bool)
Entry is ignored if set to false
Bits: 47..48
sourcepub fn set_present_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_present_checked(&mut self, value: bool) -> Result<(), ()>
Entry is ignored if set to false
Bits: 47..48
sourceconst fn limit_high(&self) -> u32
const fn limit_high(&self) -> u32
Most-significant bits of segment size
Bits: 48..52
sourceconst fn with_limit_high_checked(self, value: u32) -> Result<Self, ()>
const fn with_limit_high_checked(self, value: u32) -> Result<Self, ()>
Most-significant bits of segment size
Bits: 48..52
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
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
sourcefn set_limit_high_checked(&mut self, value: u32) -> Result<(), ()>
fn set_limit_high_checked(&mut self, value: u32) -> Result<(), ()>
Most-significant bits of segment size
Bits: 48..52
sourcepub const fn available(&self) -> bool
pub const fn available(&self) -> bool
Bit which can be freely used for other purposes
Bits: 52..53
sourcepub const fn with_available_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_available_checked(self, value: bool) -> Result<Self, ()>
Bit which can be freely used for other purposes
Bits: 52..53
sourcepub const fn with_available(self, value: bool) -> Self
pub const fn with_available(self, value: bool) -> Self
Bit which can be freely used for other purposes
Bits: 52..53
sourcepub fn set_available(&mut self, value: bool)
pub fn set_available(&mut self, value: bool)
Bit which can be freely used for other purposes
Bits: 52..53
sourcepub fn set_available_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_available_checked(&mut self, value: bool) -> Result<(), ()>
Bit which can be freely used for other purposes
Bits: 52..53
sourcepub const fn custom(&self) -> u8
pub const fn custom(&self) -> u8
The meaning of these bits are related to Self::descriptor_kind
and Self::kind
Bits: 53..55
sourcepub const fn with_custom_checked(self, value: u8) -> Result<Self, ()>
pub const fn with_custom_checked(self, value: u8) -> Result<Self, ()>
The meaning of these bits are related to Self::descriptor_kind
and Self::kind
Bits: 53..55
sourcepub const fn with_custom(self, value: u8) -> Self
pub const fn with_custom(self, value: u8) -> Self
The meaning of these bits are related to Self::descriptor_kind
and Self::kind
Bits: 53..55
sourcepub fn set_custom(&mut self, value: u8)
pub fn set_custom(&mut self, value: u8)
The meaning of these bits are related to Self::descriptor_kind
and Self::kind
Bits: 53..55
sourcepub fn set_custom_checked(&mut self, value: u8) -> Result<(), ()>
pub fn set_custom_checked(&mut self, value: u8) -> Result<(), ()>
The meaning of these bits are related to Self::descriptor_kind
and Self::kind
Bits: 53..55
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 const fn with_pages_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_pages_checked(self, value: bool) -> Result<Self, ()>
Uses page granularity for the segment limit (instead of bytes)
Bits: 55..56
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 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
sourcepub fn set_pages_checked(&mut self, value: bool) -> Result<(), ()>
pub fn set_pages_checked(&mut self, value: bool) -> Result<(), ()>
Uses page granularity for the segment limit (instead of bytes)
Bits: 55..56
sourceconst fn with_base_high_checked(self, value: u8) -> Result<Self, ()>
const fn with_base_high_checked(self, value: u8) -> Result<Self, ()>
Most-significant bits of base address
Bits: 56..64
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
sourcefn set_base_high_checked(&mut self, value: u8) -> Result<(), ()>
fn set_base_high_checked(&mut self, value: u8) -> Result<(), ()>
Most-significant bits of base address
Bits: 56..64
source§impl Descriptor
impl Descriptor
sourcepub const fn segment(
memory: RangeInclusive<u32>,
code: bool,
ring: Ring,
) -> Self
pub const fn segment( memory: RangeInclusive<u32>, code: bool, ring: Ring, ) -> Self
Create a code/data segment descriptor
sourcepub fn tss(tss: *const TaskStateSegment) -> Self
pub fn tss(tss: *const TaskStateSegment) -> Self
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 minus one
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 moresource§impl Debug for Descriptor
impl Debug for Descriptor
source§impl Default for Descriptor
impl Default for Descriptor
source§impl From<Descriptor> for u64
impl From<Descriptor> for u64
source§fn from(v: Descriptor) -> u64
fn from(v: Descriptor) -> u64
source§impl From<u64> for Descriptor
impl From<u64> for Descriptor
source§impl PartialEq for Descriptor
impl PartialEq for Descriptor
impl Copy for Descriptor
impl Eq for Descriptor
impl StructuralPartialEq for Descriptor
Auto Trait Implementations§
impl Freeze for Descriptor
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnwindSafe for Descriptor
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)