Scheduler work

master
able 2023-06-26 07:55:37 -05:00
parent 64d84b8684
commit 0c7c4447c3
3 changed files with 27 additions and 1 deletions

View File

@ -4,7 +4,7 @@ TODO
- Build out the object system
- Build or Find an acceptable IDL
Short List of potentials
- [Jerma](https://github.com/OriDevTeam/jerma-rs)
- [comline](https://git.ablecorp.us/DOOME1M8Cover/comline)
- Work on a styleguide for commits
Maybe something allong the lines of
[relevant shorthand note] Explination

View File

@ -28,6 +28,7 @@ pub mod ipc;
mod kmain;
mod logger;
mod memory;
mod scheduler;
pub mod utils;
use versioning::Version;

25
kernel/src/scheduler.rs Normal file
View File

@ -0,0 +1,25 @@
use {
crate::host::TrapHandler,
alloc::vec::Vec,
hbvm::{validate::validate, vm::Vm},
};
pub struct Scheduler<'a> {
data: Vec<Vm<'a, TrapHandler>>,
}
impl Scheduler<'_> {
fn new_process(&mut self, program: Vec<u8>) {
#[allow(clippy::redundant_else)]
if let Err(e) = validate(&program) {
log::error!("Program validation error: {e:?}");
} else {
log::info!("valid program");
unsafe {
let mut vm = Vm::new_unchecked(&program, TrapHandler);
vm.memory.insert_test_page();
self.data.push(vm);
}
}
}
}