From 567871d18e8188e18d43a6b37326a0b13e09c0ef Mon Sep 17 00:00:00 2001 From: able Date: Mon, 26 Jun 2023 07:55:37 -0500 Subject: [PATCH] Scheduler work --- README.md | 2 +- kernel/src/lib.rs | 1 + kernel/src/scheduler.rs | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 kernel/src/scheduler.rs diff --git a/README.md b/README.md index e181c40..bf6a74a 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 1c712d2..f28fee3 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -28,6 +28,7 @@ pub mod ipc; mod kmain; mod logger; mod memory; +mod scheduler; pub mod utils; use versioning::Version; diff --git a/kernel/src/scheduler.rs b/kernel/src/scheduler.rs new file mode 100644 index 0000000..4b68526 --- /dev/null +++ b/kernel/src/scheduler.rs @@ -0,0 +1,25 @@ +use { + crate::host::TrapHandler, + alloc::vec::Vec, + hbvm::{validate::validate, vm::Vm}, +}; + +pub struct Scheduler<'a> { + data: Vec>, +} + +impl Scheduler<'_> { + fn new_process(&mut self, program: Vec) { + #[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); + } + } + } +}