Scheduler work
This commit is contained in:
parent
1dd330e604
commit
567871d18e
|
@ -4,7 +4,7 @@ TODO
|
||||||
- Build out the object system
|
- Build out the object system
|
||||||
- Build or Find an acceptable IDL
|
- Build or Find an acceptable IDL
|
||||||
Short List of potentials
|
Short List of potentials
|
||||||
- [Jerma](https://github.com/OriDevTeam/jerma-rs)
|
- [comline](https://git.ablecorp.us/DOOME1M8Cover/comline)
|
||||||
- Work on a styleguide for commits
|
- Work on a styleguide for commits
|
||||||
Maybe something allong the lines of
|
Maybe something allong the lines of
|
||||||
[relevant shorthand note] Explination
|
[relevant shorthand note] Explination
|
||||||
|
|
|
@ -28,6 +28,7 @@ pub mod ipc;
|
||||||
mod kmain;
|
mod kmain;
|
||||||
mod logger;
|
mod logger;
|
||||||
mod memory;
|
mod memory;
|
||||||
|
mod scheduler;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
use versioning::Version;
|
use versioning::Version;
|
||||||
|
|
25
kernel/src/scheduler.rs
Normal file
25
kernel/src/scheduler.rs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue