diff --git a/ableos/.cargo/config.toml b/ableos/.cargo/config.toml index 06f0486c..d1fcae5d 100644 --- a/ableos/.cargo/config.toml +++ b/ableos/.cargo/config.toml @@ -1,5 +1,9 @@ + + + [build] -target = "./json_targets/x86_64-ableos.json" +# target = "./json_targets/x86_64-ableos.json" +target = "x86_64-unknown-uefi" [unstable] build-std = ["core", "compiler_builtins", "alloc"] @@ -7,6 +11,7 @@ build-std-features = ["compiler-builtins-mem"] [target.'cfg(target_arch = "x86_64")'] +rustflags = ["-C", "target-feature=+rdrnd"] runner = "bootimage runner" [target.riscv64gc-unknown-none-elf] diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index cb5e881e..8b8dfe08 100644 --- a/ableos/Cargo.lock +++ b/ableos/Cargo.lock @@ -39,6 +39,7 @@ dependencies = [ "pic8259", "picorand", "pretty-hex", + "rdrand", "rkyv", "serde", "serde_json", @@ -46,6 +47,7 @@ dependencies = [ "smoltcp", "spin", "uart_16550", + "uefi", "unicode-width", "vga", "volatile 0.2.7", @@ -410,6 +412,21 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" + +[[package]] +name = "rdrand" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4e0d5cb05cb40e4e5805399c27b12a064427cf553081ae9b82bc1a88111a576" +dependencies = [ + "rand_core", +] + [[package]] name = "rhai" version = "1.4.0" @@ -604,6 +621,38 @@ dependencies = [ "x86_64", ] +[[package]] +name = "ucs2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad643914094137d475641b6bab89462505316ec2ce70907ad20102d28a79ab8" +dependencies = [ + "bit_field", +] + +[[package]] +name = "uefi" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21398a404f6fa14f6df34756714874eccdf73587eba863cb5bd55d8bada7496" +dependencies = [ + "bitflags", + "log", + "ucs2", + "uefi-macros", +] + +[[package]] +name = "uefi-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7006b85ae8acaf2b448c5f1630a434caaacaedcc0907f12404e4e31c9dafcdb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "unicode-width" version = "0.1.9" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index c8258a93..e339a5bb 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -10,7 +10,12 @@ panic = "abort" [package.metadata.bootimage] run-args = [ "-cpu", - "kvm64-v1", + # "kvm64-v1", + # Support for rdrand + # "Broadwell", + "EPYC-v1", + + "-serial", "stdio", "-smp", @@ -18,8 +23,8 @@ run-args = [ # An example gpu used with ableOS - "-device", - "virtio-gpu", + # "-device", + # "virtio-gpu", # An example disk used with ableOS "-device", @@ -46,6 +51,14 @@ pretty-hex = "0.2.1" unicode-width = "0.1.7" picorand = "*" # watson = "0.4" +uefi = { version="*", features = ["exts"] } + + +[dependencies.rdrand] +version = "0.8.1" +default-features = false + + [dependencies.serde] version = "*" diff --git a/ableos/json_targets/x86_64-ableos.json b/ableos/json_targets/x86_64-ableos.json index 23da62b2..346fefdc 100644 --- a/ableos/json_targets/x86_64-ableos.json +++ b/ableos/json_targets/x86_64-ableos.json @@ -12,4 +12,4 @@ "panic-strategy": "abort", "disable-redzone": true, "features": "-mmx,-sse,+soft-float" -} +} \ No newline at end of file diff --git a/ableos/src/boot_conf.rs b/ableos/src/boot_conf.rs index fd08d2a4..1678a8c8 100644 --- a/ableos/src/boot_conf.rs +++ b/ableos/src/boot_conf.rs @@ -1,4 +1,5 @@ use log::LevelFilter; +// use rkyv::{Deserialize, Serialize}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Debug, Deserialize)] diff --git a/ableos/src/scheduler/mod.rs b/ableos/src/scheduler/mod.rs index 776f6b66..e1afdb87 100644 --- a/ableos/src/scheduler/mod.rs +++ b/ableos/src/scheduler/mod.rs @@ -17,7 +17,7 @@ use proc::{Process, PID}; #[cfg(test)] mod tests; -use crate::file::PathRep; +use crate::{file::PathRep, kmain::generate_process_pass}; use self::capabilities::Capabilities; @@ -117,6 +117,7 @@ impl Scheduler { pub fn new_process(&mut self, priority: Priority) -> Process { let process = Process { id: self.free_pid.clone(), + password: generate_process_pass(), capabilities: Capabilities::empty(), priority, }; diff --git a/ableos/src/scheduler/new_sched.rs b/ableos/src/scheduler/new_sched.rs index bb5bf9ce..31536bcb 100644 --- a/ableos/src/scheduler/new_sched.rs +++ b/ableos/src/scheduler/new_sched.rs @@ -2,6 +2,7 @@ use alloc::vec::Vec; use crate::{ capabilities::Capabilities, + kmain::generate_process_pass, proc::{Process, PID}, Priority, }; @@ -66,6 +67,7 @@ impl Scheduler { pub fn new_process(&mut self, priority: Priority) -> Process { let process = Process { id: self.free_pid, + password: generate_process_pass(), priority, capabilities: Capabilities::empty(), }; diff --git a/ableos/src/scheduler/proc.rs b/ableos/src/scheduler/proc.rs index c44e6ed6..601b6c2e 100644 --- a/ableos/src/scheduler/proc.rs +++ b/ableos/src/scheduler/proc.rs @@ -12,6 +12,10 @@ pub struct PID(pub usize); pub struct Process { /// Internal PID pub id: PID, + + /// Process password + pub password: u128, + /// pub capabilities: Capabilities, /// A process's priority