From 008a8eb336a4a3e271ac7c12b417db2a149a99e1 Mon Sep 17 00:00:00 2001 From: able Date: Wed, 13 Sep 2023 02:19:37 -0500 Subject: [PATCH] More tracing --- kernel/src/arch/aarch64/mod.rs | 2 ++ kernel/src/arch/x86_64/device_info_collector.rs | 1 + kernel/src/arch/x86_64/mod.rs | 2 +- kernel/src/kmain.rs | 4 +++- kernel/src/logger.rs | 2 +- kernel/src/task.rs | 2 ++ 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs index 9bc405d..0aad2c7 100644 --- a/kernel/src/arch/aarch64/mod.rs +++ b/kernel/src/arch/aarch64/mod.rs @@ -32,3 +32,5 @@ pub fn spin_loop() -> ! { pub fn hardware_random_u64() -> u64 { 0 } + +pub fn register_dump() {} diff --git a/kernel/src/arch/x86_64/device_info_collector.rs b/kernel/src/arch/x86_64/device_info_collector.rs index 4430f3a..4cea5eb 100644 --- a/kernel/src/arch/x86_64/device_info_collector.rs +++ b/kernel/src/arch/x86_64/device_info_collector.rs @@ -53,6 +53,7 @@ fn collect_cpu_info(device_tree: &mut DeviceTree) { } pub fn collect_device_info() { + log::trace!("Collecting devices on x86_64"); // Lock device tree unsafe { DEVICE_TREE.force_unlock(); diff --git a/kernel/src/arch/x86_64/mod.rs b/kernel/src/arch/x86_64/mod.rs index 14c95ad..16ec21d 100644 --- a/kernel/src/arch/x86_64/mod.rs +++ b/kernel/src/arch/x86_64/mod.rs @@ -45,7 +45,6 @@ unsafe extern "C" fn _kernel_start() -> ! { .expect("tried to get physical memory mapping offset from Limine") .offset, )); - allocator::init(INITIAL_KERNEL_HEAP_START, INITIAL_KERNEL_HEAP_SIZE as _); static MMAP_REQ: MemmapRequest = MemmapRequest::new(0); @@ -115,6 +114,7 @@ unsafe extern "C" fn _kernel_start() -> ! { // TODO: Add in rdseed and rdrand as sources for randomness let _rand = xml::XMLElement::new("Random"); + log::trace!("Getting boot modules"); let bm = MOD_REQ.get_response().get(); let mut bootmodules = alloc::vec::Vec::new(); diff --git a/kernel/src/kmain.rs b/kernel/src/kmain.rs index 550fab2..a2e8109 100644 --- a/kernel/src/kmain.rs +++ b/kernel/src/kmain.rs @@ -33,7 +33,9 @@ pub fn kmain(cmdline: &str, boot_modules: BootModules) -> ! { let dt = DEVICE_TREE.lock(); - info!("Device Tree: {}", dt); + // TODO(Able): This line causes a deadlock + // info!("Device Tree: {}", dt); + info!("Boot complete. Moving to init_system"); // TODO: schedule the disk driver from the initramfs diff --git a/kernel/src/logger.rs b/kernel/src/logger.rs index 486a368..5f5ae65 100644 --- a/kernel/src/logger.rs +++ b/kernel/src/logger.rs @@ -4,7 +4,7 @@ use log::{Level, SetLoggerError}; pub fn init() -> Result<(), SetLoggerError> { log::set_logger(&crate::logger::Logger)?; - log::set_max_level(log::LevelFilter::Debug); + log::set_max_level(log::LevelFilter::Trace); Ok(()) } diff --git a/kernel/src/task.rs b/kernel/src/task.rs index ea39f84..4c603e1 100644 --- a/kernel/src/task.rs +++ b/kernel/src/task.rs @@ -106,6 +106,7 @@ struct Task { impl Task { pub fn new(future: impl Future + Send + 'static) -> Self { + log::trace!("New task scheduled"); Self { future: Box::pin(future), } @@ -129,6 +130,7 @@ struct TaskWaker { impl Wake for TaskWaker { fn wake(self: Arc) { + log::trace!("Woke Task-{:?}", self.id); self.wake_by_ref(); }