Substituted to the original ch7 code.

This commit is contained in:
Yifan Wu 2022-01-18 02:48:50 -08:00
parent 4fdd55e2e8
commit 57f7debbc6
50 changed files with 2786 additions and 128 deletions

View file

@ -5,14 +5,14 @@ mod manager;
mod processor;
mod pid;
use crate::loader::get_app_data_by_name;
use crate::fs::{open_file, OpenFlags};
use switch::__switch;
use task::{TaskControlBlock, TaskStatus};
use alloc::sync::Arc;
use manager::fetch_task;
use lazy_static::*;
pub use context::TaskContext;
pub use processor::{
run_tasks,
current_task,
@ -76,9 +76,11 @@ pub fn exit_current_and_run_next(exit_code: i32) {
}
lazy_static! {
pub static ref INITPROC: Arc<TaskControlBlock> = Arc::new(
TaskControlBlock::new(get_app_data_by_name("initproc").unwrap())
);
pub static ref INITPROC: Arc<TaskControlBlock> = Arc::new({
let inode = open_file("initproc", OpenFlags::RDONLY).unwrap();
let v = inode.read_all();
TaskControlBlock::new(v.as_slice())
});
}
pub fn add_initproc() {