feat(userspace): log server sole console holder; init boots from manifest; adapter loads only init+storage
This commit is contained in:
55
crates/init/src/manifest.rs
Normal file
55
crates/init/src/manifest.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
//! What init starts, in order: the system's boot policy, as data.
|
||||
|
||||
use types::budget::Limits;
|
||||
|
||||
/// A board device init hands to a program over its endpoint.
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Device {
|
||||
Gpu,
|
||||
Input,
|
||||
}
|
||||
|
||||
pub struct Program {
|
||||
pub name: &'static str,
|
||||
pub file: &'static [u8],
|
||||
pub limits: Limits,
|
||||
/// Serves an endpoint, which it finds in slot 0.
|
||||
pub serves: bool,
|
||||
pub device: Option<Device>,
|
||||
/// Earlier programs' endpoints it may call, in its next slots.
|
||||
pub uses: &'static [&'static str],
|
||||
/// Takes the console over from init; everyone else prints through it.
|
||||
pub console: bool,
|
||||
}
|
||||
|
||||
/// Enough for a small program: its image, stack and a little heap.
|
||||
pub const SMALL: Limits = Limits {
|
||||
pages: 64,
|
||||
endpoints: 2,
|
||||
notifications: 2,
|
||||
regions: 2,
|
||||
};
|
||||
|
||||
const fn server(name: &'static str, file: &'static [u8], limits: Limits) -> Program {
|
||||
Program { name, file, limits, serves: true, device: None, uses: &[], console: false }
|
||||
}
|
||||
|
||||
/// Started on every boot. The log server comes first so the rest can print.
|
||||
pub const SERVERS: &[Program] = &[
|
||||
Program { console: true, ..server("log", b"log.elf", SMALL) },
|
||||
Program {
|
||||
device: Some(Device::Gpu),
|
||||
// The framebuffer alone is ~1000 pages at 1280x800.
|
||||
..server("display", b"display.elf", Limits { pages: 1280, regions: 4, ..SMALL })
|
||||
},
|
||||
Program { device: Some(Device::Input), ..server("input", b"input.elf", Limits { regions: 4, ..SMALL }) },
|
||||
server("permis", b"permis.elf", SMALL),
|
||||
server("session", b"session.elf", SMALL),
|
||||
];
|
||||
|
||||
/// The desktop; the test image runs the SMP self-test instead.
|
||||
pub const APPS: &[Program] = &[Program {
|
||||
serves: false,
|
||||
uses: &["input", "display"],
|
||||
..server("snake", b"snake.elf", Limits { pages: 128, ..SMALL })
|
||||
}];
|
||||
Reference in New Issue
Block a user