Function kernel::process::load [] [src]

unsafe fn load(tbf_header: TbfHeader, mem_base: *mut u8) -> Option<LoadResult>

Loads the process into memory

Loads the process whos binary starts at flash_start_addr into the memory region beginning at mem_base. The process binary must fit within mem_size bytes.

This function will optionally copy the GOT and data segment into memory as well as zero out the BSS section. It also optionally performs relocation on the GOT and on variables named in the relocation section of the binary.

Note: If we are doing the relocation, we place the stack at the bottom of the memory space so that a stack overflow will trigger an MPU violation rather than overwriting GOT/BSS/.data sections. The stack is not included in the flash data, however, which means that the offset values for everything above the stack in the elf header need to have the stack offset added.

The function returns a LoadResult containing metadata about the loaded process or None if loading failed.