//! Kernel Code #![allow(non_snake_case)] #![allow(clippy::upper_case_acronyms,dead_code)] #![feature(format_args_nl)] #![feature(panic_info_message)] #![feature(trait_alias)] #![feature(exclusive_range_pattern)] #![no_main] #![no_std] mod alloc; mod console; mod cpu; mod panic_wait; 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 { } }