diff options
author | Nathan Ringo <nathan@remexre.com> | 2024-02-25 01:18:10 -0600 |
---|---|---|
committer | Nathan Ringo <nathan@remexre.com> | 2024-02-25 10:59:35 -0600 |
commit | 178cb5bb0755064a0824b1b3d564260db412ea92 (patch) | |
tree | c9917506abe9d2b9910f01a383b9320513a69c53 /kernel/src/lib.rs | |
parent | c8de43bf43242c4ebac3d0ecb8e7951fe2371506 (diff) |
[console] Adds the start of a console subsystem to handle kernel logs.
The idea is that this is an output-only facility that log messages from
the log crate are written to. It has a small buffer, and relies on a log
destination regularly reading from the buffer.
In the next commit, platform-specific code will be able to provide a
"strict flush" routine, which runs after every write to the buffer and
drains the buffer. This is mainly to help kernel development, where it's
not assured that the kernel will even get as far in boot as initializing
its allocator.
Eventually, there will be a console fd that userspace can request, wait
on, and read from.
Diffstat (limited to 'kernel/src/lib.rs')
-rw-r--r-- | kernel/src/lib.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index bd5a19f..4a2483a 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -1,16 +1,19 @@ #![no_std] +pub mod console; +pub mod util; + +#[cfg(not(test))] mod panic; /// The entrypoint to the kernel. This should be executed by hart0 alone. It performs some early /// boot tasks, then wakes up any other harts. #[no_mangle] -pub extern "C" fn hart0_boot() { - for byte in "Hello, world!\n".bytes() { - unsafe { - core::ptr::write_volatile(0x10000000 as *mut u8, byte); - } - } +pub extern "C" fn hart0_boot(device_tree: *const u32) { + console::init(); + + log::info!("device_tree = {device_tree:?}"); + dbg!(42); todo!() } |