Struct axhal::arch::TrapFrame

source ·
#[repr(C)]
pub struct TrapFrame {
Show 22 fields pub rax: u64, pub rcx: u64, pub rdx: u64, pub rbx: u64, pub rbp: u64, pub rsi: u64, pub rdi: u64, pub r8: u64, pub r9: u64, pub r10: u64, pub r11: u64, pub r12: u64, pub r13: u64, pub r14: u64, pub r15: u64, pub vector: u64, pub error_code: u64, pub rip: u64, pub cs: u64, pub rflags: u64, pub rsp: u64, pub ss: u64,
}
Expand description

Saved registers when a trap (interrupt or exception) occurs.

Fields§

§rax: u64§rcx: u64§rdx: u64§rbx: u64§rbp: u64§rsi: u64§rdi: u64§r8: u64§r9: u64§r10: u64§r11: u64§r12: u64§r13: u64§r14: u64§r15: u64§vector: u64§error_code: u64§rip: u64§cs: u64§rflags: u64§rsp: u64§ss: u64

Implementations§

source§

impl TrapFrame

source

pub const fn is_user(&self) -> bool

Whether the trap is from userspace.

source

pub fn set_user_sp(&mut self, user_sp: usize)

To set the stack pointer

source

pub fn app_init_context(app_entry: usize, user_sp: usize) -> Self

用于第一次进入应用程序时的初始化

source

pub fn set_ret_code(&mut self, ret_value: usize)

set the return code

source

pub fn set_tls(&mut self, _tls_value: usize)

设置TLS

source

pub fn get_sp(&self) -> usize

获取 sp

source

pub fn set_pc(&mut self, pc: usize)

设置 pc

source

pub fn set_arg0(&mut self, arg: usize)

设置 arg0

source

pub fn set_arg1(&mut self, arg: usize)

设置 arg1

source

pub fn set_arg2(&mut self, arg: usize)

设置 arg2

source

pub fn get_pc(&self) -> usize

获取 pc

source

pub fn get_ret_code(&self) -> usize

获取 ret

source

pub fn set_ra(&mut self, _ra: usize)

设置返回地址

source

pub fn get_syscall_args(&self) -> [usize; 6]

获取所有 syscall 参数

source

pub fn get_syscall_num(&self) -> usize

获取 syscall id

Trait Implementations§

source§

impl Clone for TrapFrame

source§

fn clone(&self) -> TrapFrame

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TrapFrame

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for TrapFrame

source§

fn default() -> TrapFrame

Returns the “default value” for a type. Read more
source§

impl Copy for TrapFrame

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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.
source§

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

Performs the conversion.