feat(kernel): shared ABI decoder+proofs, no-panic gate, syscall storm, kani on shrunk kernel
This commit is contained in:
@@ -17,7 +17,7 @@ mod tests;
|
||||
#[path = "proofs.rs"]
|
||||
mod proofs;
|
||||
|
||||
pub const MAX_NOTIFICATIONS: usize = 128;
|
||||
pub const MAX_NOTIFICATIONS: usize = if cfg!(kani) { 1 } else { 128 };
|
||||
|
||||
/// What the kernel must do after a signal.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -84,6 +84,10 @@ impl Notification {
|
||||
self.bits != 0
|
||||
}
|
||||
|
||||
pub fn waiters(&self) -> impl Iterator<Item = ThreadId> + '_ {
|
||||
self.waiters.iter()
|
||||
}
|
||||
|
||||
pub fn is_waiter(&self, thread: ThreadId) -> bool {
|
||||
self.waiters.contains(thread)
|
||||
}
|
||||
@@ -132,10 +136,14 @@ impl NotificationTable {
|
||||
}
|
||||
|
||||
pub fn create(&mut self, owner: ProcessId) -> Option<NotificationId> {
|
||||
let idx = (0..MAX_NOTIFICATIONS)
|
||||
.find(|&i| self.slots[i].is_none() && self.generations.is_usable(i))?;
|
||||
let generations = &self.generations;
|
||||
let (idx, slot) = self
|
||||
.slots
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
.find(|(i, s)| s.is_none() && generations.is_usable(*i))?;
|
||||
let id = NotificationId::from_raw(idx as u16);
|
||||
self.slots[idx] = Some(Notification::new(id, owner));
|
||||
*slot = Some(Notification::new(id, owner));
|
||||
Some(id)
|
||||
}
|
||||
|
||||
@@ -158,6 +166,10 @@ impl NotificationTable {
|
||||
Some(n)
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> impl Iterator<Item = &Notification> {
|
||||
self.slots.iter().flatten()
|
||||
}
|
||||
|
||||
pub fn ids_owned_by(&self, owner: ProcessId) -> impl Iterator<Item = NotificationId> + '_ {
|
||||
self.slots
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user