Try some filesystems

This commit is contained in:
2026-02-13 15:52:43 +01:00
parent 369ff5fef4
commit a53e11d6dd
9 changed files with 73 additions and 47 deletions

View File

@@ -4,14 +4,14 @@ use alloc::string::String;
use log::info;
use crate::{
process::{create_processus, ExecutionContext, Process, ProcessState},
process::{create_process, ExecutionContext, Process, ProcessState},
time,
};
pub const PROCESSUS_COUNT: usize = 16;
pub const PROCESS_COUNT: usize = 16;
pub static mut ACTIVE_PID: usize = 0;
pub static mut PROCESS_TABLE: LazyCell<[Process; PROCESSUS_COUNT]> = LazyCell::new(|| {
pub static mut PROCESS_TABLE: LazyCell<[Process; PROCESS_COUNT]> = LazyCell::new(|| {
array::from_fn(|_| Process {
pid: -1,
name: String::new(),
@@ -29,10 +29,11 @@ pub static mut PROCESS_TABLE: LazyCell<[Process; PROCESSUS_COUNT]> = LazyCell::n
mstatus: 0,
},
stack: [0; _],
entry: None,
})
});
pub extern "C" fn idle() {
pub fn idle() {
loop {
// write_string_temp("idle");
// info!("idle");
@@ -44,13 +45,13 @@ pub extern "C" fn idle() {
pub fn scheduler_init() {
info!("scheduler init");
for pid in 0..PROCESSUS_COUNT {
for pid in 0..PROCESS_COUNT {
unsafe {
PROCESS_TABLE[pid].state = ProcessState::Dead;
}
}
create_processus(idle, "idle");
create_process(idle, "idle");
unsafe {
PROCESS_TABLE[0].state = ProcessState::Active;
}
@@ -72,7 +73,7 @@ pub fn scheduler(interrupt_state: ExecutionContext) -> *const ExecutionContext {
{
PROCESS_TABLE[ACTIVE_PID].state = ProcessState::Activable;
}
ACTIVE_PID = (ACTIVE_PID + 1) % PROCESSUS_COUNT;
ACTIVE_PID = (ACTIVE_PID + 1) % PROCESS_COUNT;
if PROCESS_TABLE[ACTIVE_PID].state == ProcessState::Activable {
break;
}