aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kernel.rs2
-rw-r--r--src/mem/alloc.rs10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/kernel.rs b/src/kernel.rs
index 28d8f87..3d93e37 100644
--- a/src/kernel.rs
+++ b/src/kernel.rs
@@ -40,7 +40,7 @@ use crate::mem::alloc::alloc;
/// the regular main.
unsafe fn kernel_init() -> ! {
console().init().unwrap();
- alloc().init();
+ alloc().init().unwrap();
kernel_main()
}
diff --git a/src/mem/alloc.rs b/src/mem/alloc.rs
index fcd33c2..f4ba935 100644
--- a/src/mem/alloc.rs
+++ b/src/mem/alloc.rs
@@ -5,7 +5,8 @@
use alloc::alloc::{GlobalAlloc,Layout};
use crate::sync::NullLock;
use crate::sync::interface::Mutex;
-use core::fmt::{Debug,Formatter,Result};
+use core::fmt;
+use core::fmt::{Debug,Formatter};
/// # Initialize Queue
/// - Name: Symbol name
@@ -58,7 +59,7 @@ impl<T: Debug> Debug for QueueItem<'_,T> {
/// # Debug formatter for `QueueItem`
///
/// Output the encapsulated data
- fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
write!(f, "{:?}", self.data)
}
}
@@ -149,7 +150,7 @@ impl<T: Debug,const COUNT: usize> Debug for QueueAllocator<'_,T,COUNT> {
///
/// Output each data point in the array with
/// its debug formatter.
- fn fmt(&self, f: &mut Formatter<'_>) -> Result {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
self.inner.lock(|queue| {
write!(f, "{:?}", queue)
})
@@ -235,7 +236,7 @@ init_queue!(U2048_GRAND_ALLOC, GRAND_ALLOC_SIZE, {U2048::new()}, U2048);
init_queue!(U4096_GRAND_ALLOC, GRAND_ALLOC_SIZE, {U4096::new()}, U4096);
impl GrandAllocator {
- pub fn init(&self) {
+ pub fn init(&self) -> Result<(), &'static str> {
U8_GRAND_ALLOC.init();
U16_GRAND_ALLOC.init();
U32_GRAND_ALLOC.init();
@@ -246,6 +247,7 @@ impl GrandAllocator {
U1024_GRAND_ALLOC.init();
U2048_GRAND_ALLOC.init();
U4096_GRAND_ALLOC.init();
+ Ok(())
}
}