diff options
Diffstat (limited to 'src/kernel.rs')
-rw-r--r-- | src/kernel.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel.rs b/src/kernel.rs index 56f53c1..9377eb5 100644 --- a/src/kernel.rs +++ b/src/kernel.rs @@ -9,6 +9,7 @@ #![no_main] #![no_std] +mod alloc; mod console; mod cpu; mod panic_wait; @@ -16,15 +17,26 @@ mod print; mod sync; mod uart; use crate::console::console; +use crate::alloc::CHAR_ALLOCATOR; /// Initialization Code unsafe fn kernel_init() -> ! { console().init().unwrap(); + CHAR_ALLOCATOR.init(); kernel_main() } /// Post init 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); + } else { + println!("ERROR: No more chars remaining! {:?}", CHAR_ALLOCATOR); + } + } println!("I should be able to print {} here!", 5); loop { } } |