pub struct UserContext(/* private fields */);Available on crate feature
uspace only.Expand description
Context to enter user space.
Implementations§
Source§impl UserContext
impl UserContext
Sourcepub fn new(entry: usize, ustack_top: VirtAddr, arg0: usize) -> Self
pub fn new(entry: usize, ustack_top: VirtAddr, arg0: usize) -> Self
Creates a new context with the given entry point, user stack pointer, and the argument.
Sourcepub fn prepare_clone_child_return_state(&mut self)
pub fn prepare_clone_child_return_state(&mut self)
Normalizes a cloned user context so it can safely return to user mode.
Sourcepub fn run(&mut self) -> ReturnReason
pub fn run(&mut self) -> ReturnReason
Enter user space.
It restores the user registers and jumps to the user entry point
(saved in sepc).
This function returns when an exception or syscall occurs.
Methods from Deref<Target = TrapFrame>§
Sourcepub fn set_retval(&mut self, a0: usize)
pub fn set_retval(&mut self, a0: usize)
Sets the return value register.
Sourcepub unsafe fn emulate_unaligned(&mut self) -> Result<(), UnalignedError>
pub unsafe fn emulate_unaligned(&mut self) -> Result<(), UnalignedError>
Emulates an unaligned memory access triggered by a trap.
§Safety
This function uses raw pointers and inline assembly to handle unaligned memory accesses, so it must only be called in a valid trap context with a properly initialized TrapFrame.
Trait Implementations§
Source§impl Clone for UserContext
impl Clone for UserContext
Source§fn clone(&self) -> UserContext
fn clone(&self) -> UserContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UserContext
impl Debug for UserContext
Source§impl Deref for UserContext
impl Deref for UserContext
Source§impl DerefMut for UserContext
impl DerefMut for UserContext
impl Copy for UserContext
Auto Trait Implementations§
impl Freeze for UserContext
impl RefUnwindSafe for UserContext
impl Send for UserContext
impl Sync for UserContext
impl Unpin for UserContext
impl UnsafeUnpin for UserContext
impl UnwindSafe for UserContext
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
Mutably borrows from an owned value. Read more