Module 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).