feat(kernel): add Send and Receive IPC syscalls with rendezvous

This commit is contained in:
2026-10-18 00:24:09 +02:00
parent ae6023081a
commit e7835c0435
4 changed files with 326 additions and 0 deletions

View File

@@ -194,6 +194,32 @@ impl<P: Platform> Kernel<P> {
self.scheduler.remove(tid);
}
#[cfg(test)]
pub fn switch_to_thread_for_test(&mut self, tid: ThreadId) {
use domain::scheduler::Scheduler;
let core = self.platform.core_id();
if let Some(current) = self.scheduler.current(core) {
if current == tid {
return;
}
if let Ok(t) = self.threads.get_mut(current) {
if matches!(t.state(), ThreadState::Running(_)) {
let priority = t.priority();
let _ = t.preempt();
self.scheduler.add(current, priority, core);
}
}
}
if let Ok(t) = self.threads.get(tid) {
if matches!(t.state(), ThreadState::Ready) {
self.scheduler.next(core);
let _ = self.threads.get_mut(tid).map(|t| t.set_running(core));
}
}
}
#[cfg(test)]
pub fn create_endpoint_for_test(&mut self) -> types::id::EndpointId {
self.endpoints.create().expect("create endpoint")