feat: implement context switching, SavedContext with pc/status fields, wire all syscall outcomes and timer preemption

This commit is contained in:
2026-10-18 02:34:36 +02:00
parent 5a45c14cf5
commit 7724a5bd0a
7 changed files with 195 additions and 27 deletions

View File

@@ -97,8 +97,4 @@ impl Kernel<MockPlatform> {
) -> CapSlot {
self.grant_cap(pid, resource, permissions).expect("grant cap")
}
pub fn thread_context(&self, tid: ThreadId) -> &domain::thread::SavedContext {
self.threads.get(tid).expect("thread").saved_context()
}
}

View File

@@ -28,9 +28,9 @@ fn spawn_thread_preserves_entry_and_stack() {
SyscallOutcome::Complete(SyscallResult::Value(v)) => ThreadId::from_raw(v as u16),
_ => panic!("expected Value"),
};
let ctx = k.thread_context(tid);
let ctx = k.thread_context(tid).unwrap();
assert_eq!(ctx.program_counter(), 0xDEAD);
assert_eq!(ctx.stack_pointer(), 0xBEEF);
assert_eq!(ctx.registers()[2], 0xBEEF);
}
#[test]