# Module os::loader

source · [−]
Expand description

Loading user applications into memory

For chapter 3, user applications are simply part of the data included in the kernel binary, so we only need to copy them to the space allocated for each app to load them. We also allocate fixed spaces for each task’s `KernelStack` and `UserStack`.

## Structs

KernelStack 🔒
UserStack 🔒

## Statics

KERNEL_STACK 🔒
USER_STACK 🔒

## Functions

get_base_i 🔒

Get base address of app i.

get_num_app

Get the total number of applications.

init_app_cx

get app info with entry and sp and save `TrapContext` in kernel stack

load_apps

Load nth user app at [APP_BASE_ADDRESS + n * APP_SIZE_LIMIT, APP_BASE_ADDRESS + (n+1) * APP_SIZE_LIMIT).