Implement domain and endpoint modules with capability management, message passing, and scheduling features
This commit is contained in:
@@ -3,3 +3,12 @@ pub struct EntryPoint(usize);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct StackPointer(usize);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct VirtualAddress(usize);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct DataRef {
|
||||
addr: VirtualAddress,
|
||||
len: usize,
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ use crate::macros::bounded;
|
||||
|
||||
bounded!(CapSlot, u8, 0, 63);
|
||||
bounded!(Priority, u8, 0, 31);
|
||||
bounded!(PageCount, u16, 1, 1024);
|
||||
|
||||
@@ -9,3 +9,27 @@ impl Ticks {
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct TimerDuration(u32);
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct TimeSlice {
|
||||
remaining: u32,
|
||||
quantum: u32,
|
||||
}
|
||||
|
||||
impl TimeSlice {
|
||||
pub fn new(quantum: u32) -> Self {
|
||||
Self {
|
||||
remaining: quantum,
|
||||
quantum,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tick(&mut self) -> bool {
|
||||
self.remaining = self.remaining.saturating_sub(1);
|
||||
self.remaining == 0
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.remaining = self.quantum;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user