Struct kernel::process::Process  
                   
                       [−]
                   
               [src]
pub struct Process<'a> {
    memory: &'static mut [u8],
    kernel_memory_break: *const u8,
    app_break: *const u8,
    current_stack_pointer: *const u8,
    text: &'static [u8],
    header: TbfHeader,
    stored_regs: StoredRegs,
    yield_pc: usize,
    psr: usize,
    state: State,
    fault_response: FaultResponse,
    mpu_regions: [Cell<(*const u8, PowerOfTwo)>; 5],
    tasks: RingBuffer<'a, Task>,
    pub package_name: &'static str,
    debug: ProcessDebug,
}Fields
memory: &'static mut [u8]
                           Application memory layout:
    ╒════════ ← memory[memory.len()]
 ╔═ │ Grant
    │   ↓
 D  │ ──────  ← kernel_memory_break
 Y  │
 N  │ ──────  ← app_break
 A  │
 M  │   ↑
    │  Heap
 ╠═ │ ──────  ← app_heap_start
    │  Data
 F  │ ──────  ← data_start_pointer
 I  │ Stack
 X  │   ↓
 E  │
 D  │ ──────  ← current_stack_pointer
    │
 ╚═ ╘════════ ← memory[0]
The process's memory.
kernel_memory_break: *const u8
                           Pointer to the end of the allocated (and MPU protected) grant region.
app_break: *const u8
                           Pointer to the end of process RAM that has been sbrk'd to the process.
current_stack_pointer: *const u8
                           Saved when the app switches to the kernel.
text: &'static [u8]
                           Process text segment
header: TbfHeader
                           Collection of pointers to the TBF header in flash.
stored_regs: StoredRegs
                           Saved each time the app switches to the kernel.
yield_pc: usize
                           The PC to jump to when switching back to the app.
psr: usize
                           Process State Register.
state: State
                           Whether the scheduler can schedule this app.
fault_response: FaultResponse
                           How to deal with Faults occurring in the process
mpu_regions: [Cell<(*const u8, PowerOfTwo)>; 5]
                           MPU regions are saved as a pointer-size pair.
size is encoded as X where SIZE = 2(X + 1) and X >= 4.
A null pointer represents an empty region.
Invariants
The pointer must be aligned to the size. E.g. if the size is 32 bytes, the pointer must be 32-byte aligned.
tasks: RingBuffer<'a, Task>
                           Essentially a list of callbacks that want to call functions in the process.
package_name: &'static str
                           Name of the app. Public so that IPC can use it.
debug: ProcessDebug
                           Values kept so that we can print useful debug messages when apps fault.
Methods
impl<'a> Process<'a>[src]
pub fn schedule_ipc(&mut self, from: AppId, cb_type: IPCType)[src]
pub fn current_state(&self) -> State[src]
pub fn yield_state(&mut self)[src]
pub unsafe fn fault_state(&mut self)[src]
pub fn dequeue_task(&mut self) -> Option<Task>[src]
pub fn mem_start(&self) -> *const u8[src]
pub fn mem_end(&self) -> *const u8[src]
pub fn flash_start(&self) -> *const u8[src]
pub fn flash_non_protected_start(&self) -> *const u8[src]
pub fn flash_end(&self) -> *const u8[src]
pub fn kernel_memory_break(&self) -> *const u8[src]
pub fn number_writeable_flash_regions(&self) -> usize[src]
pub fn get_writeable_flash_region(&self, region_index: usize) -> (u32, u32)[src]
pub fn update_stack_start_pointer(&mut self, stack_pointer: *const u8)[src]
pub fn update_heap_start_pointer(&mut self, heap_pointer: *const u8)[src]
pub fn setup_mpu<MPU: MPU>(&self, mpu: &MPU)[src]
pub fn add_mpu_region(&self, base: *const u8, size: u32) -> bool[src]
pub unsafe fn create(
    app_flash_address: *const u8, 
    remaining_app_memory: *mut u8, 
    remaining_app_memory_size: usize, 
    fault_response: FaultResponse
) -> (Option<Process<'a>>, usize, usize)[src]
app_flash_address: *const u8,
remaining_app_memory: *mut u8,
remaining_app_memory_size: usize,
fault_response: FaultResponse
) -> (Option<Process<'a>>, usize, usize)
pub fn sbrk(&mut self, increment: isize) -> Result<*const u8, Error>[src]
pub fn brk(&mut self, new_break: *const u8) -> Result<*const u8, Error>[src]
pub fn in_exposed_bounds(&self, buf_start_addr: *const u8, size: usize) -> bool[src]
pub unsafe fn alloc(&mut self, size: usize) -> Option<&mut [u8]>[src]
pub unsafe fn free<T>(&mut self, _: *mut T)[src]
unsafe fn grant_ptr<T>(&self, grant_num: usize) -> *mut *mut T[src]
pub unsafe fn grant_for<T>(&mut self, grant_num: usize) -> *mut T[src]
pub unsafe fn grant_for_or_alloc<T: Default>(
    &mut self, 
    grant_num: usize
) -> Option<*mut T>[src]
&mut self,
grant_num: usize
) -> Option<*mut T>
pub fn pop_syscall_stack(&mut self)[src]
pub unsafe fn push_function_call(&mut self, callback: FunctionCall)[src]
Context switch to the process.
pub unsafe fn app_fault(&self) -> bool[src]
pub unsafe fn syscall_fired(&self) -> bool[src]
pub unsafe fn switch_to(&mut self)[src]
Context switch to the process.