Recover idle process. Make shell wait for the user it spawned.

master
WangRunji 6 years ago
parent 04b62ec79f
commit 52d3443e05

@ -29,9 +29,10 @@ pub fn shell() {
continue;
}
if let Ok(file) = root.borrow().lookup(name.as_str()) {
let len = file.borrow().read_at(0, &mut *buf).unwrap();
use process::*;
processor().add(Context::new_user(&buf[..len]));
let len = file.borrow().read_at(0, &mut *buf).unwrap();
let pid = processor().add(Context::new_user(&buf[..len]));
processor().current_wait_for(pid);
} else {
println!("Program not exist");
}

@ -10,11 +10,18 @@ type Processor = Processor_<Context, StrideScheduler>;
pub fn init() {
PROCESSOR.call_once(||
SpinNoIrqLock::new(Processor::new(
SpinNoIrqLock::new({
let mut processor = Processor::new(
unsafe { Context::new_init() },
// NOTE: max_time_slice <= 5 to ensure 'priority' test pass
StrideScheduler::new(5),
))
);
extern fn idle(arg: usize) -> ! {
loop {}
}
processor.add(Context::new_kernel(idle, 0));
processor
})
);
}

Loading…
Cancel
Save