feat(kernel): console cap gates DebugPutchar, no uart fast path; spawn start arg in a0; delegate returns slot
This commit is contained in:
@@ -11,6 +11,7 @@ fn spawn_thread_creates_ready_thread() {
|
||||
let outcome = k.handle_syscall(Syscall::SpawnThread {
|
||||
entry: EntryPoint::from_raw(0x1000),
|
||||
stack: StackPointer::from_raw(0x2000),
|
||||
arg: 0,
|
||||
});
|
||||
assert!(matches!(
|
||||
outcome,
|
||||
@@ -19,11 +20,12 @@ fn spawn_thread_creates_ready_thread() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spawn_thread_preserves_entry_and_stack() {
|
||||
fn spawn_thread_preserves_entry_stack_and_arg() {
|
||||
let (mut k, _) = kernel_with_process();
|
||||
let tid = match k.handle_syscall(Syscall::SpawnThread {
|
||||
entry: EntryPoint::from_raw(0xDEAD),
|
||||
stack: StackPointer::from_raw(0xBEEF),
|
||||
arg: 0x5107,
|
||||
}) {
|
||||
SyscallOutcome::Complete(SyscallResult::Value(v)) => ThreadId::from_raw(v as u16),
|
||||
_ => panic!("expected Value"),
|
||||
@@ -31,6 +33,11 @@ fn spawn_thread_preserves_entry_and_stack() {
|
||||
let ctx = k.thread_context(tid).unwrap();
|
||||
assert_eq!(ctx.program_counter(), 0xDEAD);
|
||||
assert_eq!(ctx.registers()[2], 0xBEEF);
|
||||
assert_eq!(
|
||||
ctx.registers()[10],
|
||||
0x5107,
|
||||
"the start argument arrives in a0"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user