use types::{ address::{DataRef, EntryPoint, StackPointer, VirtualAddress}, bounded::{CapSlot, PageCount}, permission::PermissionSet, }; use crate::message::Message; pub struct WaitSet { endpoints: [Option; 4], interrupts: [Option; 4], } impl WaitSet { pub fn new( endpoints: [Option; 4], interrupts: [Option; 4], ) -> Self { Self { endpoints, interrupts } } pub fn endpoints(&self) -> &[Option; 4] { &self.endpoints } pub fn interrupts(&self) -> &[Option; 4] { &self.interrupts } pub fn is_empty(&self) -> bool { self.endpoints.iter().all(|s| s.is_none()) && self.interrupts.iter().all(|s| s.is_none()) } } pub enum WakeReason { MessageReady(CapSlot), InterruptFired(CapSlot), } pub enum Syscall { Send { endpoint: CapSlot, message: Message, }, Receive { endpoint: CapSlot, }, Delegate { slot: CapSlot, to_endpoint: CapSlot, permissions: PermissionSet, }, WaitForInterrupt { irq: CapSlot, }, AcknowledgeInterrupt { irq: CapSlot, }, WaitAny { sources: WaitSet, }, CreateProcess { create_cap: CapSlot, image: DataRef, }, Kill { process: CapSlot, }, Revoke { slot: CapSlot, }, SpawnThread { entry: EntryPoint, stack: StackPointer, }, ExitThread, RequestPages { count: PageCount, }, ReleasePages { addr: VirtualAddress, count: PageCount, }, GetTime, GetProcessId, Yield, Exit, Halt, CreateEndpoint, DebugPutchar { byte: u8 }, MapPage { process: CapSlot, src_va: VirtualAddress, dst_va: VirtualAddress, executable: bool, }, SpawnThreadIn { process: CapSlot, entry: EntryPoint, stack: StackPointer, }, }