Basic executable format writeup

main
~erin 2023-04-18 16:17:27 -04:00
parent 8fdbee17bc
commit 064988574a
Signed by untrusted user: erin
GPG Key ID: 9A8E308CEFA37A47
1 changed files with 26 additions and 0 deletions

View File

@ -81,6 +81,32 @@ will be determined via [capabilities](/development/design/actor.md#ocap)
- Snapshots - Snapshots
- Isolation - 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 [^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**? [^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**?