aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kernel.rs11
-rw-r--r--src/mem.rs1
-rw-r--r--src/mem/alloc.rs63
-rw-r--r--src/mem/types.rs54
4 files changed, 66 insertions, 63 deletions
diff --git a/src/kernel.rs b/src/kernel.rs
index 012a7ff..a848ce5 100644
--- a/src/kernel.rs
+++ b/src/kernel.rs
@@ -59,10 +59,13 @@ unsafe fn kernel_init() -> ! {
fn kernel_main() -> ! {
#[cfg(not(feature="verbose"))]
{
- draw::draw_ukraine_flag();
- println!();
- draw::draw_american_flag();
- println!();
+ #[cfg(feature="flag")]
+ {
+ draw::draw_ukraine_flag();
+ println!();
+ draw::draw_american_flag();
+ println!();
+ }
println!("\x1b[91mInitialized\x1b[0m \x1b[92m{}\x1b[0m \x1b[93mv{}\x1b[0m", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
println!("\x1b[94mAuthors:\x1b[0m \x1b[95m{}\x1b[0m", env!("CARGO_PKG_AUTHORS"));
diff --git a/src/mem.rs b/src/mem.rs
index ab630cb..e32bb13 100644
--- a/src/mem.rs
+++ b/src/mem.rs
@@ -2,3 +2,4 @@
//!
//! Provides the Allocator for the OS.
pub mod alloc;
+mod types;
diff --git a/src/mem/alloc.rs b/src/mem/alloc.rs
index 1861c2c..e665f41 100644
--- a/src/mem/alloc.rs
+++ b/src/mem/alloc.rs
@@ -8,6 +8,7 @@ use crate::sync::interface::Mutex;
use crate::vprintln;
use core::fmt;
use core::fmt::{Debug,Formatter};
+use super::types::*;
/// # Initialize Queue
/// - Name: Symbol name
@@ -41,6 +42,7 @@ pub struct QueueItem<'a, T: Sized> {
/// to the next item.
next: Option<*mut QueueItem<'a, T>>,
}
+
impl<T> QueueItem<'_,T> {
/// # Get the inner data
///
@@ -53,6 +55,7 @@ impl<T> QueueItem<'_,T> {
self.inner() as *mut T as *mut u8
}
}
+
/// # Sharing Thread Safety for QueueItem
unsafe impl<T> Send for QueueItem<'_,T> {}
@@ -78,6 +81,7 @@ pub struct QueueAllocator<'a, T: Sized, const COUNT: usize> {
/// Stores synchronization wrapper around the data pool
pub inner: NullLock<[QueueItem<'a, T>;COUNT]>,
}
+
/// # Sharing Thread Safety for QueueAllocator
unsafe impl<T,const COUNT: usize> Send for QueueAllocator<'_,T,COUNT> {}
@@ -176,65 +180,6 @@ impl<T: Debug,const COUNT: usize> Debug for QueueAllocator<'_,T,COUNT> {
}
}
-
-
-
-
-/// # u256 struct
-///
-/// 256 bit size field
-#[derive(Copy,Clone)]
-pub struct U256(u128,u128);
-impl U256 {
- pub const fn new() -> Self {
- U256(0,0)
- }
-}
-
-/// # u512 struct
-///
-/// 512 bit size field
-#[derive(Copy,Clone)]
-pub struct U512(U256,U256);
-impl U512 {
- pub const fn new() -> Self {
- U512(U256::new(), U256::new())
- }
-}
-
-/// # u1024 struct
-///
-/// 1024 bit size field
-#[derive(Copy,Clone)]
-pub struct U1024(U512,U512);
-impl U1024 {
- pub const fn new() -> Self {
- U1024(U512::new(), U512::new())
- }
-}
-
-/// # u2048 struct
-///
-/// 2048 bit size field
-#[derive(Copy,Clone)]
-pub struct U2048(U1024,U1024);
-impl U2048 {
- pub const fn new() -> Self {
- U2048(U1024::new(), U1024::new())
- }
-}
-
-/// # u4096 struct
-///
-/// 4096 bit size field
-#[derive(Copy,Clone)]
-pub struct U4096(U2048,U2048);
-impl U4096 {
- pub const fn new() -> Self {
- U4096(U2048::new(), U2048::new())
- }
-}
-
/// # Grand Allocator
///
/// The structure that uses different sized pools and allocates memory chunks
diff --git a/src/mem/types.rs b/src/mem/types.rs
new file mode 100644
index 0000000..04522bc
--- /dev/null
+++ b/src/mem/types.rs
@@ -0,0 +1,54 @@
+/// # u256 struct
+///
+/// 256 bit size field
+#[derive(Copy,Clone)]
+pub struct U256(u128,u128);
+impl U256 {
+ pub const fn new() -> Self {
+ U256(0,0)
+ }
+}
+
+/// # u512 struct
+///
+/// 512 bit size field
+#[derive(Copy,Clone)]
+pub struct U512(U256,U256);
+impl U512 {
+ pub const fn new() -> Self {
+ U512(U256::new(), U256::new())
+ }
+}
+
+/// # u1024 struct
+///
+/// 1024 bit size field
+#[derive(Copy,Clone)]
+pub struct U1024(U512,U512);
+impl U1024 {
+ pub const fn new() -> Self {
+ U1024(U512::new(), U512::new())
+ }
+}
+
+/// # u2048 struct
+///
+/// 2048 bit size field
+#[derive(Copy,Clone)]
+pub struct U2048(U1024,U1024);
+impl U2048 {
+ pub const fn new() -> Self {
+ U2048(U1024::new(), U1024::new())
+ }
+}
+
+/// # u4096 struct
+///
+/// 4096 bit size field
+#[derive(Copy,Clone)]
+pub struct U4096(U2048,U2048);
+impl U4096 {
+ pub const fn new() -> Self {
+ U4096(U2048::new(), U2048::new())
+ }
+}