pub struct ThreadState<T: RegisterStorage> {
pub registers: RegisterState<T>,
pub extended_pstate: ExtendedPstateState,
pub restart_code: Option<ErrnoCode>,
pub syscall_restart_func: Option<Box<dyn FnOnce(&mut Locked<Unlocked>, &mut CurrentTask) -> Result<SyscallResult, Errno> + Send + Sync>>,
pub arch_width: ArchWidth,
}Expand description
The thread related information of a CurrentTask. The information should never be used outside
of the thread owning the CurrentTask.
Fields§
§registers: RegisterState<T>A copy of the registers associated with the Zircon thread. Up-to-date values can be read
from self.handle.read_state_general_regs(). To write these values back to the thread, call
self.handle.write_state_general_regs(self.thread_state.registers.into()).
extended_pstate: ExtendedPstateStateCopy of the current extended processor state including floating point and vector registers.
restart_code: Option<ErrnoCode>The errno code (if any) that indicated this task should restart a syscall.
syscall_restart_func: Option<Box<dyn FnOnce(&mut Locked<Unlocked>, &mut CurrentTask) -> Result<SyscallResult, Errno> + Send + Sync>>A custom function to resume a syscall that has been interrupted by SIGSTOP. To use, call set_syscall_restart_func and return ERESTART_RESTARTBLOCK. sys_restart_syscall will eventually call it.
arch_width: ArchWidthAn architecture agnostic enum indicating the width (32 or 64 bits) of the execution environment in use.
Implementations§
Source§impl<T: RegisterStorage> ThreadState<T>
impl<T: RegisterStorage> ThreadState<T>
pub fn extended_snapshot<R: RegisterStorage>(&self) -> ThreadState<R>
pub fn replace_registers<O: RegisterStorage>(&mut self, other: &ThreadState<O>)
pub fn get_user_register(&mut self, offset: usize) -> Result<usize, Errno>
pub fn set_user_register( &mut self, offset: usize, value: usize, ) -> Result<(), Errno>
Trait Implementations§
Source§impl<T: RegisterStorage> ArchSpecific for ThreadState<T>
impl<T: RegisterStorage> ArchSpecific for ThreadState<T>
Source§impl<T: Default + RegisterStorage> Default for ThreadState<T>
impl<T: Default + RegisterStorage> Default for ThreadState<T>
Source§fn default() -> ThreadState<T>
fn default() -> ThreadState<T>
Source§impl From<ThreadState<HeapRegs>> for ThreadState<RegisterStorageEnum>
impl From<ThreadState<HeapRegs>> for ThreadState<RegisterStorageEnum>
Source§fn from(value: ThreadState<HeapRegs>) -> Self
fn from(value: ThreadState<HeapRegs>) -> Self
Auto Trait Implementations§
impl<T> Freeze for ThreadState<T>where
T: Freeze,
impl<T> !RefUnwindSafe for ThreadState<T>
impl<T> Send for ThreadState<T>where
T: Send,
impl<T> Sync for ThreadState<T>where
T: Sync,
impl<T> Unpin for ThreadState<T>where
T: Unpin,
impl<T> !UnwindSafe for ThreadState<T>
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more