xous-core/apps/app-loader/spawn
Vihaan Jim ded9049ee4 Turn app-loader into an app instead of a service
When the user selects App Loader from the app menu, a new menu shows
up that displays the currently loaded apps (in the future this will
contain options to add/remove apps as well). This is a much more sane
approach than whatever I was doing before because it requires minimal
changes to the rest of the source tree (I had to change xtask so that
it would replace -'s with _'s in constant names so that I could name
my app app-loader).
2023-08-01 22:16:40 -04:00
..
src Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00
build.rs Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00
Cargo.toml Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00
link.x Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00
README.md Turn app-loader into an app instead of a service 2023-08-01 22:16:40 -04:00

Spawn a process

This crate represents an initial program that will run when a process starts up. It will listen on a Server and take orders from the parent process to finish setting itself up.

Initialization

The process starts with a stack and a text section but no heap, BSS, or data section. The entrypoint looks like this:

pub extern "C" init(a1: u32, a2: u32, a3: u32, a4: u32) -> ! {
    let sid = xous::SID::from_u32(a1, a2, a3, a4);
    loop {}
}

This process is responsible for performing its own bootstrapping (i.e. allocating/initializing .data and .bss), after which it should accept messages on the connection and copy data as necessary.

API

The following messages are supported:

Mnemonic Opcode Type Description
WriteMemory 1 M Write memory into an area of memory. The Offset field is used to determine where the block will start.
WriteArgs 2 M Reserved
WriteEnvironment 3 M Reserved
FinishSetup 255 * Terminate the loop, shutdown the server, and start the program.