1
0
Fork 0
forked from AbleOS/ableos

Proc changes

This commit is contained in:
Able 2022-02-04 18:47:05 -06:00
parent b3b9cc3c76
commit 2d5e8d24eb
8 changed files with 81 additions and 6 deletions

View file

@ -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]

49
ableos/Cargo.lock generated
View file

@ -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"

View file

@ -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 = "*"

View file

@ -12,4 +12,4 @@
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}
}

View file

@ -1,4 +1,5 @@
use log::LevelFilter;
// use rkyv::{Deserialize, Serialize};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Debug, Deserialize)]

View file

@ -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,
};

View file

@ -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(),
};

View file

@ -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