summaryrefslogtreecommitdiffstats
path: root/bins/klog
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bins/klog/Cargo.toml8
-rw-r--r--bins/klog/src/main.rs19
2 files changed, 27 insertions, 0 deletions
diff --git a/bins/klog/Cargo.toml b/bins/klog/Cargo.toml
new file mode 100644
index 0000000..73957ec
--- /dev/null
+++ b/bins/klog/Cargo.toml
@@ -0,0 +1,8 @@
1[package]
2name = "klog"
3version.workspace = true
4edition.workspace = true
5[lints]
6workspace = true
7[dependencies]
8rsapi = { path = "../../rsapi" }
diff --git a/bins/klog/src/main.rs b/bins/klog/src/main.rs
new file mode 100644
index 0000000..fcd3512
--- /dev/null
+++ b/bins/klog/src/main.rs
@@ -0,0 +1,19 @@
1//! klog — dump kernel log via the exports table.
2
3#![no_std]
4#![no_main]
5
6#[panic_handler]
7fn panic(_info: &core::panic::PanicInfo) -> ! {
8 loop { core::hint::spin_loop(); }
9}
10
11#[unsafe(no_mangle)]
12pub extern "C" fn efi_main(exports: &'static rsapi::Exports, _argc: usize, _argv: *const rsapi::Arg) -> i32 {
13 let mut buf = [0u8; 2048];
14 let n = (exports.klog_dump)(buf.as_mut_ptr(), buf.len() as u64) as usize;
15 if n > 0 {
16 (exports.put_line)(rsapi::Line { ptr: buf.as_ptr(), len: n });
17 }
18 0
19}