This commit is contained in:
Yifan Wu 2023-03-29 20:51:50 +08:00
parent 91ecdc59d4
commit b7e19c5418

View File

@ -23,6 +23,7 @@ mod switch;
mod task; mod task;
use crate::loader::get_app_data_by_name; use crate::loader::get_app_data_by_name;
use crate::sbi::shutdown;
use alloc::sync::Arc; use alloc::sync::Arc;
use lazy_static::*; use lazy_static::*;
pub use manager::{fetch_task, TaskManager}; pub use manager::{fetch_task, TaskManager};
@ -58,8 +59,6 @@ pub fn suspend_current_and_run_next() {
/// pid of usertests app in make run TEST=1 /// pid of usertests app in make run TEST=1
pub const IDLE_PID: usize = 0; pub const IDLE_PID: usize = 0;
use crate::board::QEMUExit;
/// Exit the current 'Running' task and run the next task in task list. /// Exit the current 'Running' task and run the next task in task list.
pub fn exit_current_and_run_next(exit_code: i32) { pub fn exit_current_and_run_next(exit_code: i32) {
// take from Processor // take from Processor
@ -73,10 +72,10 @@ pub fn exit_current_and_run_next(exit_code: i32) {
); );
if exit_code != 0 { if exit_code != 0 {
//crate::sbi::shutdown(255); //255 == -1 for err hint //crate::sbi::shutdown(255); //255 == -1 for err hint
crate::board::QEMU_EXIT_HANDLE.exit_failure(); shutdown(true)
} else { } else {
//crate::sbi::shutdown(0); //0 for success hint //crate::sbi::shutdown(0); //0 for success hint
crate::board::QEMU_EXIT_HANDLE.exit_success(); shutdown(false)
} }
} }