Struct os::task::TaskControlBlock
source · pub struct TaskControlBlock {
pub task_cx: TaskContext,
pub task_status: TaskStatus,
pub memory_set: MemorySet,
pub trap_cx_ppn: PhysPageNum,
pub base_size: usize,
pub heap_bottom: usize,
pub program_brk: usize,
}Expand description
The task control block (TCB) of a task.
Fields§
§task_cx: TaskContextSave task context
task_status: TaskStatusMaintain the execution status of the current process
memory_set: MemorySetApplication address space
trap_cx_ppn: PhysPageNumThe phys page number of trap context
base_size: usizeThe size(top addr) of program which is loaded from elf file
heap_bottom: usizeHeap bottom
program_brk: usizeProgram break
Implementations§
source§impl TaskControlBlock
impl TaskControlBlock
sourcepub fn get_trap_cx(&self) -> &'static mut TrapContext
pub fn get_trap_cx(&self) -> &'static mut TrapContext
get the trap context
sourcepub fn get_user_token(&self) -> usize
pub fn get_user_token(&self) -> usize
get the user token
sourcepub fn new(elf_data: &[u8], app_id: usize) -> Self
pub fn new(elf_data: &[u8], app_id: usize) -> Self
Based on the elf info in program, build the contents of task in a new address space
sourcepub fn change_program_brk(&mut self, size: i32) -> Option<usize>
pub fn change_program_brk(&mut self, size: i32) -> Option<usize>
change the location of the program break. return None if failed.
Auto Trait Implementations§
impl Freeze for TaskControlBlock
impl RefUnwindSafe for TaskControlBlock
impl Send for TaskControlBlock
impl Sync for TaskControlBlock
impl Unpin for TaskControlBlock
impl UnwindSafe for TaskControlBlock
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