diff --git a/kernel/src/allocator.rs b/kernel/src/allocator.rs index bd225bf..2f6ce0b 100644 --- a/kernel/src/allocator.rs +++ b/kernel/src/allocator.rs @@ -324,7 +324,7 @@ impl Heap { (unsafe { *self.bitmap.add(index / 8) } & (1 << (index % 8))) != 0 } - const fn free_chunks(&self) -> usize { + pub const fn free_chunks(&self) -> usize { self.total_chunks - self.allocated_chunks } @@ -345,3 +345,7 @@ fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! { // Todo: Maybe panic here instead crate::arch::spin_loop() } + +pub fn get_free_chunks_count() -> usize { + ALLOCATOR.0.lock().as_ref().unwrap().free_chunks() +} diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index e11aa75..ff7aeee 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -1,5 +1,7 @@ //! Environment call handling routines +use crate::allocator; + use { super::{mem::Memory, Vm}, crate::{arch, holeybytes::mem, ipc::buffer::IpcBuffer, kmain::IPC_BUFFERS}, @@ -71,7 +73,10 @@ pub fn handler(vm: &mut Vm) { Err(err) => log::error!("Improper log format"), }, 2 => match memory_msg_handler(vm, mem_addr, length) { - Ok(()) => {} + Ok(()) => { + let free_chunks = allocator::get_free_chunks_count(); + debug!("Free chunk count: {}", free_chunks); + } Err(err) => log::error!("Improper log format"), }, buffer_id => { diff --git a/kernel/src/kmain.rs b/kernel/src/kmain.rs index e6757e3..93380a8 100644 --- a/kernel/src/kmain.rs +++ b/kernel/src/kmain.rs @@ -2,6 +2,7 @@ use { crate::{ + arch::hardware_random_u64, bootmodules::{build_cmd, BootModules}, capabilities, device_tree::DeviceTree, @@ -93,6 +94,8 @@ pub fn kmain(cmdline: &str, boot_modules: BootModules) -> ! { }); } + info!("{}", hardware_random_u64()); + executor.run(); }; diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index 3c0fa82..ae2448f 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -1,10 +1,14 @@ -use std::{fs, io::Write, process::exit}; - use { derive_more::Display, error_stack::{bail, report, Context, Report, Result, ResultExt}, fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek}, - std::{fmt::Display, fs::File, io, path::Path, process::Command}, + std::{ + fmt::Display, + fs::{self, File}, + io::{self, Write}, + path::Path, + process::{exit, Command}, + }, }; fn main() -> Result<(), Error> { diff --git a/sysdata/config.format b/sysdata/config.format index 7be4f88..3ed572d 100644 --- a/sysdata/config.format +++ b/sysdata/config.format @@ -1,10 +1,22 @@ Boolean + Stuffed into a u8 to be indexed into + + 00_00_00_01 + ^^--- One Boolean + |the Second Boolean + UTF8 String + "Able The Above" => UTF8 14 bytes long Date Time (U128 seconds since the beginning of the universe) Binary Blob List - Ordered/Unordered Bound/Unbound + // Ordered/Unordered + + Examples: + OSPath Is Unbounded List + +Hashmap \ No newline at end of file diff --git a/sysdata/testing.idl b/sysdata/testing.idl new file mode 100644 index 0000000..d3ed326 --- /dev/null +++ b/sysdata/testing.idl @@ -0,0 +1,53 @@ +type String { + length uint32, + data [u8; length], +} + + +// needs three bits to store this +@exhaustive +enum LogLevel { + Error = 0, + Warn = 1, + Info = 2, + Debug = 3, + Trace = 4, +} + +type LogMessage { + log_level = LogLevel, + log_message = String, +} + + + +// This is displayed as bits sent over the wire +[ + 010 // INFO + 00000000_00000000_00000000_00000011 // Length of the string + 01001000 // H + 01101001 // i + 00100001 // ! +] + + + + + + +enum LogResult { + Ok, + Error, +} + +protocol Logger { + fn log(LogMessage) -> LogResult; + fn flush() -> LogResult; +} + + + + + + +