feat: implement context switching, SavedContext with pc/status fields, wire all syscall outcomes and timer preemption
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user