From 064988574ac21972db95f003b23cd0ff95fb5d1a Mon Sep 17 00:00:00 2001 From: Erin Abicht Date: Tue, 18 Apr 2023 16:17:27 -0400 Subject: [PATCH] Basic executable format writeup --- src/development/design/filesystem.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/development/design/filesystem.md b/src/development/design/filesystem.md index 2b7ef05..7c5884f 100644 --- a/src/development/design/filesystem.md +++ b/src/development/design/filesystem.md @@ -81,6 +81,32 @@ will be determined via [capabilities](/development/design/actor.md#ocap) - Snapshots - Isolation +## Executable Format +Programs written in userspace will need to follow a specific format. +First, users will write a program in **Rust**, using the **Mercury** libraries, and with `no-std`. +They'll use [Actors](/development/design/actor.md) to communicate with the `kernel`. +Then, they'll compile it for the proper platform and get a pure binary. + +This will be ran through an *executable packer* program, and the output of which can be downloaded by the package manager, put on disk, etc. +It'll then parsed in via `bincode`, then the core is ran by the `kernel` in userspace. +Additionally, the raw bytes will be compressed. + +Then, whether reading from [chunks](#chunk) from memory or disk, we can know whether it will run on the current system, how long to read for, and when the compressed bytes start (due to the fixed length header). +It is then simple to decompress the raw bytes and run them from the `kernel`. + +```rust +enum Architecture { + RiscV, + Arm, +} + +struct PackedExecutable { + arch: Architecture, + size: u64, + compressed_bytes: [u8], +} +``` + [^encryption]: Specific details to be figured out later [^find_chunk]: Currently via magic. I have no idea how to do this other than a simple search. Maybe generate an index, or use a **UUID**?