Struct tartan_arch::x86_common::protection::Selector
source · pub struct Selector(/* private fields */);
Expand description
A reference to an entry in a segment descriptor table.
Used as the value of the segment registers CS
, DS
, etc. as well as the
LocalDescriptorTableRegister
and TaskRegister
.
Implementations§
source§impl Selector
impl Selector
sourcepub fn privilege_level(&self) -> u8
pub fn privilege_level(&self) -> u8
RPL
: The privilege level “requested” when accessing the referenced segment.
This may be different than the current privilege level (CPL), in which case the access must allowed for both the CPL and RPL. This is intended to allow OS code to limit its privileges when executing on behalf of user code.
sourcepub fn local(&self) -> bool
pub fn local(&self) -> bool
Indicates that this selector references a descriptor in the local descriptor table (LDT). Otherwise, it references the global descriptor table (GDT).
sourcepub fn set_privilege_level(&mut self, value: u8)
pub fn set_privilege_level(&mut self, value: u8)
RPL
: The privilege level “requested” when accessing the referenced segment.
This may be different than the current privilege level (CPL), in which case the access must allowed for both the CPL and RPL. This is intended to allow OS code to limit its privileges when executing on behalf of user code.
sourcepub fn with_privilege_level(&self, value: u8) -> Self
pub fn with_privilege_level(&self, value: u8) -> Self
RPL
: The privilege level “requested” when accessing the referenced segment.
This may be different than the current privilege level (CPL), in which case the access must allowed for both the CPL and RPL. This is intended to allow OS code to limit its privileges when executing on behalf of user code.
sourcepub fn set_local(&mut self, value: bool)
pub fn set_local(&mut self, value: bool)
Indicates that this selector references a descriptor in the local descriptor table (LDT). Otherwise, it references the global descriptor table (GDT).
sourcepub fn with_local(&mut self, value: bool) -> Self
pub fn with_local(&mut self, value: bool) -> Self
Indicates that this selector references a descriptor in the local descriptor table (LDT). Otherwise, it references the global descriptor table (GDT).
source§impl Selector
impl Selector
sourcepub const fn new(offset: u16, privilege_level: u8, local: bool) -> Self
pub const fn new(offset: u16, privilege_level: u8, local: bool) -> Self
Create a new selector with the given field values
sourcepub fn set_offset(&mut self, offset: u16)
pub fn set_offset(&mut self, offset: u16)
Update the offset of the referenced entry in the descriptor table.
§Panics
Panics if the new offset is not aligned on an 8-byte boundary.
sourcepub fn descriptor_address(self) -> usize
pub fn descriptor_address(self) -> usize
Calculate the address of the descriptor referenced by this selector
Trait Implementations§
impl Copy for Selector
impl Eq for Selector
impl StructuralPartialEq for Selector
Auto Trait Implementations§
impl Freeze for Selector
impl RefUnwindSafe for Selector
impl Send for Selector
impl Sync for Selector
impl Unpin for Selector
impl UnwindSafe for Selector
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)