forked from AbleOS/ableos
more changes
This commit is contained in:
parent
7c68609af5
commit
89b495d318
|
@ -324,7 +324,7 @@ impl Heap {
|
||||||
(unsafe { *self.bitmap.add(index / 8) } & (1 << (index % 8))) != 0
|
(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
|
self.total_chunks - self.allocated_chunks
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,3 +345,7 @@ fn alloc_error_handler(layout: alloc::alloc::Layout) -> ! {
|
||||||
// Todo: Maybe panic here instead
|
// Todo: Maybe panic here instead
|
||||||
crate::arch::spin_loop()
|
crate::arch::spin_loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_free_chunks_count() -> usize {
|
||||||
|
ALLOCATOR.0.lock().as_ref().unwrap().free_chunks()
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
//! Environment call handling routines
|
//! Environment call handling routines
|
||||||
|
|
||||||
|
use crate::allocator;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
super::{mem::Memory, Vm},
|
super::{mem::Memory, Vm},
|
||||||
crate::{arch, holeybytes::mem, ipc::buffer::IpcBuffer, kmain::IPC_BUFFERS},
|
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"),
|
Err(err) => log::error!("Improper log format"),
|
||||||
},
|
},
|
||||||
2 => match memory_msg_handler(vm, mem_addr, length) {
|
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"),
|
Err(err) => log::error!("Improper log format"),
|
||||||
},
|
},
|
||||||
buffer_id => {
|
buffer_id => {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
|
arch::hardware_random_u64,
|
||||||
bootmodules::{build_cmd, BootModules},
|
bootmodules::{build_cmd, BootModules},
|
||||||
capabilities,
|
capabilities,
|
||||||
device_tree::DeviceTree,
|
device_tree::DeviceTree,
|
||||||
|
@ -93,6 +94,8 @@ pub fn kmain(cmdline: &str, boot_modules: BootModules) -> ! {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
info!("{}", hardware_random_u64());
|
||||||
|
|
||||||
executor.run();
|
executor.run();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
use std::{fs, io::Write, process::exit};
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
derive_more::Display,
|
derive_more::Display,
|
||||||
error_stack::{bail, report, Context, Report, Result, ResultExt},
|
error_stack::{bail, report, Context, Report, Result, ResultExt},
|
||||||
fatfs::{FileSystem, FormatVolumeOptions, FsOptions, ReadWriteSeek},
|
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> {
|
fn main() -> Result<(), Error> {
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
Boolean
|
Boolean
|
||||||
|
Stuffed into a u8 to be indexed into
|
||||||
|
|
||||||
|
00_00_00_01
|
||||||
|
^^--- One Boolean
|
||||||
|
|the Second Boolean
|
||||||
|
|
||||||
UTF8 String
|
UTF8 String
|
||||||
|
"Able The Above" => UTF8 14 bytes long
|
||||||
Date Time (U128 seconds since the beginning of the universe)
|
Date Time (U128 seconds since the beginning of the universe)
|
||||||
|
|
||||||
Binary Blob
|
Binary Blob
|
||||||
|
|
||||||
List<T>
|
List<T>
|
||||||
Ordered/Unordered
|
|
||||||
Bound/Unbound
|
Bound/Unbound
|
||||||
|
// Ordered/Unordered
|
||||||
|
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
OSPath Is Unbounded List <String>
|
||||||
|
|
||||||
|
Hashmap<K, V>
|
53
sysdata/testing.idl
Normal file
53
sysdata/testing.idl
Normal file
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue