Struct mycelium_kernel::arch::interrupt::PageFaultCode
source · pub struct PageFaultCode(/* private fields */);
Implementations§
source§impl PageFaultCode
impl PageFaultCode
sourcepub const PRESENT: Pack32<bool, PageFaultCode> = _
pub const PRESENT: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused by a page-protection violation. When not set, it was caused by a non-present page.
sourcepub const WRITE: Pack32<bool, PageFaultCode> = _
pub const WRITE: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused by a write access. When not set, it was caused by a read access.
sourcepub const USER: Pack32<bool, PageFaultCode> = _
pub const USER: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused while CPL = 3. This does not necessarily mean that the page fault was a privilege violation.
sourcepub const RESERVED_WRITE: Pack32<bool, PageFaultCode> = _
pub const RESERVED_WRITE: Pack32<bool, PageFaultCode> = _
When set, one or more page directory entries contain reserved bits which are set to 1. This only applies when the PSE or PAE flags in CR4 are set to 1.
sourcepub const INSTRUCTION_FETCH: Pack32<bool, PageFaultCode> = _
pub const INSTRUCTION_FETCH: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused by an instruction fetch. This only applies when the No-Execute bit is supported and enabled.
sourcepub const PROTECTION_KEY: Pack32<bool, PageFaultCode> = _
pub const PROTECTION_KEY: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused by a protection-key violation. The PKRU register (for user-mode accesses) or PKRS MSR (for supervisor-mode accesses) specifies the protection key rights.
sourcepub const SHADOW_STACK: Pack32<bool, PageFaultCode> = _
pub const SHADOW_STACK: Pack32<bool, PageFaultCode> = _
When set, the page fault was caused by a shadow stack access.
sourcepub const SGX: Pack32<bool, PageFaultCode> = _
pub const SGX: Pack32<bool, PageFaultCode> = _
When set, the fault was due to an SGX violation. The fault is unrelated to ordinary paging.
sourcepub const fn from_bits(bits: u32) -> PageFaultCode
pub const fn from_bits(bits: u32) -> PageFaultCode
Constructs a new instance of Self
from the provided raw bits.
sourcepub const fn new() -> PageFaultCode
pub const fn new() -> PageFaultCode
Constructs a new instance of Self
with all bits set to 0.
sourcepub fn with<T>(self, field: Pack32<T, PageFaultCode>, value: T) -> PageFaultCode
pub fn with<T>(self, field: Pack32<T, PageFaultCode>, value: T) -> PageFaultCode
Packs the bit representation of value
into self
at the bit
range designated by field
, returning a new bitfield.
sourcepub fn set<T>(
&mut self,
field: Pack32<T, PageFaultCode>,
value: T
) -> &mut PageFaultCode
pub fn set<T>( &mut self, field: Pack32<T, PageFaultCode>, value: T ) -> &mut PageFaultCode
Packs the bit representation of value
into self
at the range
designated by field
, mutating self
in place.
sourcepub fn get<T>(self, field: Pack32<T, PageFaultCode>) -> T
pub fn get<T>(self, field: Pack32<T, PageFaultCode>) -> T
Unpacks the bit range represented by field
from self
, and
converts it into a T
-typed value.
Panics
This method panics if self
does not contain a valid bit
pattern for a T
-typed value, as determined by T
’s
FromBits::try_from_bits
implementation.
sourcepub fn try_get<T>(
self,
field: Pack32<T, PageFaultCode>
) -> Result<T, <T as FromBits<u32>>::Error>
pub fn try_get<T>( self, field: Pack32<T, PageFaultCode> ) -> Result<T, <T as FromBits<u32>>::Error>
Unpacks the bit range represented by field
from self
and attempts to convert it into a T
-typed value.
Returns
Ok(T)
if aT
-typed value could be constructed from the bits insrc
Err(T::Error)
ifsrc
does not contain a valid bit pattern for aT
-typed value, as determined byT
’s [FromBits::try_from_bits
implementation.
sourcepub fn assert_valid()
pub fn assert_valid()
Asserts that all the packing specs for this type are valid.
This is intended to be used in unit tests.
sourcepub fn display_ascii(&self) -> impl Display
pub fn display_ascii(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, using only ASCII characters.
This is equivalent to formatting this bitfield using a {}
display specifier, but will never use Unicode box-drawing
characters, even when an upstream formatter uses the {:#}
fmt::Display
specifier. This is intended for use on platforms
where Unicode box drawing characters are never available.
sourcepub fn display_unicode(&self) -> impl Display
pub fn display_unicode(&self) -> impl Display
Returns a value that formats this bitfield in a multi-line format, always using Unicode box-drawing characters.
This is equivalent to formatting this bitfield using a {:#}
format specifier, but will always use Unicode box-drawing
characters, even when an upstream formatter uses the {}
fmt::Display
specifier.
Trait Implementations§
source§impl Binary for PageFaultCode
impl Binary for PageFaultCode
source§impl Clone for PageFaultCode
impl Clone for PageFaultCode
source§fn clone(&self) -> PageFaultCode
fn clone(&self) -> PageFaultCode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PageFaultCode
impl Debug for PageFaultCode
source§impl Display for PageFaultCode
impl Display for PageFaultCode
source§impl From<u32> for PageFaultCode
impl From<u32> for PageFaultCode
source§fn from(val: u32) -> PageFaultCode
fn from(val: u32) -> PageFaultCode
source§impl LowerHex for PageFaultCode
impl LowerHex for PageFaultCode
source§impl UpperHex for PageFaultCode
impl UpperHex for PageFaultCode
impl Copy for PageFaultCode
Auto Trait Implementations§
impl RefUnwindSafe for PageFaultCode
impl Send for PageFaultCode
impl Sync for PageFaultCode
impl Unpin for PageFaultCode
impl UnwindSafe for PageFaultCode
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> 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.