diff options
Diffstat (limited to 'bins/klog/src')
| -rw-r--r-- | bins/klog/src/main.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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] | ||
| 7 | fn panic(_info: &core::panic::PanicInfo) -> ! { | ||
| 8 | loop { core::hint::spin_loop(); } | ||
| 9 | } | ||
| 10 | |||
| 11 | #[unsafe(no_mangle)] | ||
| 12 | pub 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 | } | ||
