summaryrefslogtreecommitdiffstats
path: root/bins/klog/src/main.rs
blob: fcd351203a607e03f241715013a3a702d0abbe29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! klog — dump kernel log via the exports table.

#![no_std]
#![no_main]

#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
    loop { core::hint::spin_loop(); }
}

#[unsafe(no_mangle)]
pub extern "C" fn efi_main(exports: &'static rsapi::Exports, _argc: usize, _argv: *const rsapi::Arg) -> i32 {
    let mut buf = [0u8; 2048];
    let n = (exports.klog_dump)(buf.as_mut_ptr(), buf.len() as u64) as usize;
    if n > 0 {
        (exports.put_line)(rsapi::Line { ptr: buf.as_ptr(), len: n });
    }
    0
}