aboutsummaryrefslogtreecommitdiff
path: root/src/kernel.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel.rs')
-rw-r--r--src/kernel.rs36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/kernel.rs b/src/kernel.rs
index 9377eb5..3f10849 100644
--- a/src/kernel.rs
+++ b/src/kernel.rs
@@ -1,4 +1,10 @@
-//! Kernel Code
+//! # Kernel Code
+//!
+//! ## Initializes the peripherals
+//! - UART
+//! - Allocators
+
+#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")]
#![allow(non_snake_case)]
#![allow(clippy::upper_case_acronyms,dead_code)]
@@ -17,24 +23,34 @@ mod print;
mod sync;
mod uart;
use crate::console::console;
-use crate::alloc::CHAR_ALLOCATOR;
+use crate::alloc::*;
-/// Initialization Code
+/// # Initialization Code
+///
+/// Initializes
+/// - Allocators
+/// - UART
+///
+/// After initialization, jump to
+/// the regular main.
unsafe fn kernel_init() -> ! {
console().init().unwrap();
- CHAR_ALLOCATOR.init();
+ U64_QUEUE_ALLOCATOR.init();
kernel_main()
}
-/// Post init
+/// # Post-initialization
+///
+/// TODO: Figure out what to do here
fn kernel_main() -> ! {
for idx in 0..30 {
- if let Some(cell) = CHAR_ALLOCATOR.alloc() {
- cell.data = ('0' as u8 + idx as u8) as char;
- println!("SUCCESS: Allocated a char! {:?} {:?}", cell, CHAR_ALLOCATOR);
- CHAR_ALLOCATOR.free(cell);
+ if let Some(cell) = U64_QUEUE_ALLOCATOR.alloc() {
+ let inner = cell.inner();
+ *inner = idx;
+ println!("SUCCESS: Allocated a char! {:?}", cell);
+ U64_QUEUE_ALLOCATOR.free(cell);
} else {
- println!("ERROR: No more chars remaining! {:?}", CHAR_ALLOCATOR);
+ println!("ERROR: No more chars remaining!");
}
}
println!("I should be able to print {} here!", 5);