add #![deny(missing_docs)] AND #![deny(warnings)] in main.rs, and add more comments
This commit is contained in:
parent
5946903948
commit
139fbc637a
9 changed files with 42 additions and 14 deletions
|
@ -4,12 +4,16 @@ use crate::trap::trap_return;
|
|||
#[repr(C)]
|
||||
/// task context structure containing some registers
|
||||
pub struct TaskContext {
|
||||
/// return address ( e.g. __restore ) of __switch ASM function
|
||||
ra: usize,
|
||||
/// kernel stack pointer of app
|
||||
sp: usize,
|
||||
/// callee saved registers: s 0..11
|
||||
s: [usize; 12],
|
||||
}
|
||||
|
||||
impl TaskContext {
|
||||
/// init task context
|
||||
pub fn zero_init() -> Self {
|
||||
Self {
|
||||
ra: 0,
|
||||
|
@ -17,6 +21,7 @@ impl TaskContext {
|
|||
s: [0; 12],
|
||||
}
|
||||
}
|
||||
/// set Task Context{__restore ASM funciton: trap_return, sp: kstack_ptr, s: s_0..12}
|
||||
pub fn goto_trap_return(kstack_ptr: usize) -> Self {
|
||||
Self {
|
||||
ra: trap_return as usize,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue