Skip to main content

RestrictedState

Struct RestrictedState 

Source
pub struct RestrictedState { /* private fields */ }
Expand description

Encapsulates a thread’s restricted mode state, including VMO backing and mapping.

The memory layout of this struct (#[repr(C)]) must exactly match its C++ counterpart (class RestrictedState in zircon/kernel/include/kernel/restricted_state.h), as instances allocated here are directly accessed from C++ code by pointer. Any changes to field types, names, ordering, or layout must be kept in sync between the two definitions, and verified via static assertions.

Implementations§

Source§

impl RestrictedState

Source

pub fn create( exception_report_ptr: *mut zx_exception_report_t, ) -> Result<Box<Self>, Status>

Create a new RestrictedState, allocating its VMO and mapping in kernel memory.

Source

pub fn in_restricted(&self) -> bool

Return whether the thread is currently in restricted mode.

Source

pub fn set_in_restricted(&mut self, val: bool)

Set whether the thread is currently in restricted mode.

Source

pub fn vector_ptr(&self) -> usize

Return the normal mode vector table pointer.

Source

pub fn set_vector_ptr(&mut self, val: usize)

Set the normal mode vector table pointer.

Source

pub fn context(&self) -> usize

Return the normal mode context value.

Source

pub fn set_context(&mut self, val: usize)

Set the normal mode context value.

Source

pub fn exception_report_ptr(&self) -> *mut zx_exception_report_t

Return the user exception report pointer address.

Source

pub fn arch_normal_state(&self) -> &ArchSavedNormalState

Return a shared reference to the saved normal mode architecture state.

Source

pub fn arch_normal_state_mut(&mut self) -> &mut ArchSavedNormalState

Return a mutable reference to the saved normal mode architecture state.

Source

pub fn state(&self) -> &zx_restricted_state_t

Return a shared reference to the mapped zx_restricted_state_t buffer.

Source

pub fn state_mut(&mut self) -> &mut zx_restricted_state_t

Return a mutable reference to the mapped zx_restricted_state_t buffer.

Source

pub fn state_ptr(&self) -> *mut zx_restricted_state_t

Return a raw pointer to the mapped zx_restricted_state_t buffer.

Source

pub fn vmo(&self) -> *mut c_void

Return a raw pointer to the underlying VMO.

Trait Implementations§

Source§

impl Drop for RestrictedState

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl !Send for RestrictedState

§

impl !Sync for RestrictedState

§

impl Freeze for RestrictedState

§

impl RefUnwindSafe for RestrictedState

§

impl Unpin for RestrictedState

§

impl UnsafeUnpin for RestrictedState

§

impl UnwindSafe for RestrictedState

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Init<T> for T

Source§

unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn chain<F>(self, f: F) -> ChainInit<Self, F, T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

Source§

impl<T> PinInit<T> for T

Source§

unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>

Initializes slot. Read more
Source§

fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>
where F: FnOnce(Pin<&mut T>) -> Result<(), E>,

First initializes the value using self then calls the function f with the initialized value. Read more
Source§

impl<T> ToMutPtr for T
where T: ?Sized,

Source§

type Target = T

The target type of the pointer.
Source§

fn to_mut_ptr(&self) -> *mut T

Casts the reference to a mutable raw pointer.
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.