From aaf64d0a2d5b1c20845fb322f4a1548b86336b8a Mon Sep 17 00:00:00 2001 From: gil Date: Thu, 16 May 2024 08:23:08 -0500 Subject: [PATCH] Add a comment --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 777816d..4135497 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ unsafe extern "C" fn _enter() -> ! { // load hartid into t0; if t0 =/= 0, then jump to busy loop "csrr t0, mhartid", "bnez t0, 3f", - + // before we use the `la` pseudo-instruction for the first time, // we need to set `gp` (look up linker relaxation) ".option push", // pushes the current option stack @@ -73,8 +73,10 @@ extern "C" fn start() -> ! { unsafe { uart::init_console(0x1000_0000) }; println!("Hello, world!"); + // print current hartid println!("hartid: {}", riscv::register::mhartid::read()); + // poll console for input and print characters back loop { let c = uart::CONSOLE.lock().as_mut().and_then(uart::Device::get); if let Some(c) = c { @@ -85,6 +87,7 @@ extern "C" fn start() -> ! { #[panic_handler] fn on_panic(info: &PanicInfo) -> ! { + // print panic info and hang println!("{}", info); loop {}