use types::address::PhysicalAddress; use types::bounded::Priority; use types::id::IrqId; #[derive(Debug, Clone, Copy)] pub enum HardwareCap { Framebuffer { base: PhysicalAddress, pages: usize }, Irq { irq: IrqId }, Memory { base: PhysicalAddress, pages: usize }, } #[derive(Debug, Clone, Copy)] pub enum EndpointBinding { Own { name: &'static str }, ConnectTo { server: &'static str, endpoint: &'static str }, } #[derive(Debug, Clone, Copy)] pub enum BinarySource { Ram { base: PhysicalAddress, size: usize }, Storage { path: &'static str }, } #[derive(Debug)] pub struct ServerEntry { pub name: &'static str, pub priority: Priority, pub memory_pages: usize, pub hardware_caps: &'static [HardwareCap], pub endpoints: &'static [EndpointBinding], pub restartable: bool, pub binary: BinarySource, } #[derive(Debug)] pub struct BootManifest { pub servers: &'static [ServerEntry], } pub static SNAKE_MANIFEST: BootManifest = BootManifest { servers: &[ ServerEntry { name: "log", priority: Priority::DEFAULT, memory_pages: 64, hardware_caps: &[], endpoints: &[EndpointBinding::Own { name: "log" }], restartable: true, binary: BinarySource::Storage { path: "/servers/log.elf" }, }, ServerEntry { name: "permission", priority: Priority::DEFAULT, memory_pages: 32, hardware_caps: &[], endpoints: &[EndpointBinding::Own { name: "permission" }], restartable: true, binary: BinarySource::Storage { path: "/servers/permission.elf" }, }, ServerEntry { name: "storage", priority: Priority::DEFAULT, memory_pages: 128, hardware_caps: &[], endpoints: &[EndpointBinding::Own { name: "storage" }], restartable: true, binary: BinarySource::Ram { base: PhysicalAddress::from_raw(0), size: 0, }, }, ServerEntry { name: "display", priority: Priority::DEFAULT, memory_pages: 256, hardware_caps: &[ HardwareCap::Framebuffer { base: PhysicalAddress::from_raw(0x10008000), pages: 75, }, ], endpoints: &[EndpointBinding::Own { name: "display" }], restartable: true, binary: BinarySource::Storage { path: "/servers/display.elf" }, }, ServerEntry { name: "input", priority: Priority::DEFAULT, memory_pages: 32, hardware_caps: &[ HardwareCap::Irq { irq: IrqId::from_raw(10) }, ], endpoints: &[EndpointBinding::Own { name: "input" }], restartable: true, binary: BinarySource::Storage { path: "/servers/input.elf" }, }, ServerEntry { name: "session", priority: Priority::DEFAULT, memory_pages: 64, hardware_caps: &[], endpoints: &[ EndpointBinding::Own { name: "session" }, EndpointBinding::ConnectTo { server: "display", endpoint: "display" }, EndpointBinding::ConnectTo { server: "input", endpoint: "input" }, EndpointBinding::ConnectTo { server: "storage", endpoint: "storage" }, ], restartable: true, binary: BinarySource::Storage { path: "/servers/session.elf" }, }, ], };