#![allow(clippy::empty_loop)] use crate::{experiments::info::master, relib::clparse}; use { crate::{ arch::{drivers::graphics::GraphicsBuffer, init, sloop}, driver_traits::graphics::Graphics, experiments::systeminfo::{KERNEL_VERSION, RELEASE_TYPE}, keyboard::DecodedKey, relib::math::rand::RAND_HANDLE, scheduler::{test_fn, Thread, ThreadList}, }, alloc::vec, lazy_static::lazy_static, }; #[no_mangle] #[allow(unconditional_recursion)] pub extern "C" fn stack_overflow() -> u8 { stack_overflow(); // meme number 69 // NOTE: Any specific reason for this number asside from memes? } lazy_static! { pub static ref KEY_BUFFER: [DecodedKey; 256] = [DecodedKey::RawKey(123); 256]; pub static ref KEY_BUFFER_POINTER: u8 = 0; pub static ref THREAD_LIST: spin::Mutex = spin::Mutex::new(vec![]); pub static ref TICK: spin::Mutex = spin::Mutex::new(0); } #[no_mangle] pub fn kernel_main() -> ! { init::init(); // LOG_STATE.lock().log_to_screen = false; let mut a_thread = Thread::new(); a_thread.new_task(test_fn); a_thread.new_task(test_fn); THREAD_LIST.lock().push(a_thread); GraphicsBuffer::draw(); GraphicsBuffer::hide_cursor(); crate::wasm::evaluate(); info!("{} v{}", RELEASE_TYPE, KERNEL_VERSION); info!( "Brand String: {:?}", master().unwrap().brand_string().unwrap() ); println!("$PINK$Hi$RED$ from$GREEN$ able!$RESET$"); println!("$RED$hi$RESET$"); { clparse::test(); } // stack_overflow(); // crate::arch::shutdown(); sloop() } /// called by arch specific timers to tick up all kernel related functions pub fn tick() { let mut data = TICK.lock(); *data += 1; RAND_HANDLE.lock().seed_entropy_timer(*data); } pub fn key_entropy(key: u8) { RAND_HANDLE.lock().seed_entropy_keyboard(key); }