diff --git a/Cargo.toml b/Cargo.toml index 1fe3397ed..0843b1c4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,8 +94,8 @@ members = [ "services/libstd-test", "services/ffi-test", "services/tts", - "test-spawn", - "spawn", + "services/test-spawn", + "services/test-spawn/spawn", "kernel", "loader", ] diff --git a/test-spawn/Cargo.toml b/services/test-spawn/Cargo.toml similarity index 84% rename from test-spawn/Cargo.toml rename to services/test-spawn/Cargo.toml index e8c888f35..6c2267848 100644 --- a/test-spawn/Cargo.toml +++ b/services/test-spawn/Cargo.toml @@ -6,4 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -xous = {path = "../xous-rs" } \ No newline at end of file +xous = {path = "../../xous-rs" } \ No newline at end of file diff --git a/spawn/Cargo.toml b/services/test-spawn/spawn/Cargo.toml similarity index 100% rename from spawn/Cargo.toml rename to services/test-spawn/spawn/Cargo.toml diff --git a/services/test-spawn/spawn/README.md b/services/test-spawn/spawn/README.md new file mode 100644 index 000000000..6ae1c8893 --- /dev/null +++ b/services/test-spawn/spawn/README.md @@ -0,0 +1,31 @@ +# 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: + +```rust +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. | \ No newline at end of file diff --git a/spawn/build.rs b/services/test-spawn/spawn/build.rs similarity index 100% rename from spawn/build.rs rename to services/test-spawn/spawn/build.rs diff --git a/spawn/link.x b/services/test-spawn/spawn/link.x similarity index 100% rename from spawn/link.x rename to services/test-spawn/spawn/link.x diff --git a/spawn/src/main.rs b/services/test-spawn/spawn/src/main.rs similarity index 100% rename from spawn/src/main.rs rename to services/test-spawn/spawn/src/main.rs diff --git a/test-spawn/src/main.rs b/services/test-spawn/src/main.rs similarity index 100% rename from test-spawn/src/main.rs rename to services/test-spawn/src/main.rs diff --git a/test-spawn/src/spawn-stub b/services/test-spawn/src/spawn-stub similarity index 100% rename from test-spawn/src/spawn-stub rename to services/test-spawn/src/spawn-stub diff --git a/spawn/README.md b/spawn/README.md deleted file mode 100644 index 4f55cbed3..000000000 --- a/spawn/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# Spawn a process - -This crate represents the 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: - -```rust -pub extern "C" init(connection: xous::CID) -> ! { - loop {} -} -``` - -This process is responsible for performing its own bootstrapping, 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. \ No newline at end of file