feat: CI run tests
This commit is contained in:
parent
8d6a1bcc79
commit
040bba5f40
9 changed files with 81 additions and 34 deletions
|
@ -101,6 +101,7 @@ impl<T> UPIntrFreeCell<T> {
|
|||
inner: RefCell::new(value),
|
||||
}
|
||||
}
|
||||
|
||||
/// Panic if the data has been borrowed.
|
||||
pub fn exclusive_access(&self) -> UPIntrRefMut<'_, T> {
|
||||
INTR_MASKING_INFO.get_mut().enter();
|
||||
|
|
|
@ -46,6 +46,8 @@ lazy_static! {
|
|||
unsafe { UPIntrFreeCell::new(RecycleAllocator::new()) };
|
||||
}
|
||||
|
||||
pub const IDLE_PID: usize = 0;
|
||||
|
||||
pub struct PidHandle(pub usize);
|
||||
|
||||
pub fn pid_alloc() -> PidHandle {
|
||||
|
|
|
@ -17,7 +17,7 @@ use process::ProcessControlBlock;
|
|||
use switch::__switch;
|
||||
|
||||
pub use context::TaskContext;
|
||||
pub use id::{kstack_alloc, pid_alloc, KernelStack, PidHandle};
|
||||
pub use id::{kstack_alloc, pid_alloc, KernelStack, PidHandle, IDLE_PID};
|
||||
pub use manager::{add_task, pid2process, remove_from_pid2process};
|
||||
pub use processor::{
|
||||
current_kstack_top, current_process, current_task, current_trap_cx, current_trap_cx_user_va,
|
||||
|
@ -26,6 +26,7 @@ pub use processor::{
|
|||
pub use signal::SignalFlags;
|
||||
pub use task::{TaskControlBlock, TaskStatus};
|
||||
|
||||
|
||||
pub fn suspend_current_and_run_next() {
|
||||
// There must be an application running.
|
||||
let task = take_current_task().unwrap();
|
||||
|
@ -72,7 +73,12 @@ pub fn exit_current_and_run_next(exit_code: i32) {
|
|||
// however, if this is the main thread of current process
|
||||
// the process should terminate at once
|
||||
if tid == 0 {
|
||||
remove_from_pid2process(process.getpid());
|
||||
let pid = process.getpid();
|
||||
if pid == IDLE_PID {
|
||||
println!("[kernel] Idle process exit ...");
|
||||
crate::sbi::shutdown();
|
||||
}
|
||||
remove_from_pid2process(pid);
|
||||
let mut process_inner = process.inner_exclusive_access();
|
||||
// mark this process as a zombie process
|
||||
process_inner.is_zombie = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue