aboutsummaryrefslogtreecommitdiff
path: root/src/mem/alloc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/alloc.rs')
-rw-r--r--src/mem/alloc.rs63
1 files changed, 4 insertions, 59 deletions
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