summaryrefslogtreecommitdiff
path: root/src/lib.rs
blob: f94251334a9e4bf364be310d4c6c10848432c7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#![no_std]
#![no_main]

use core::panic::PanicInfo;

#[unsafe(no_mangle)]
pub extern "C" fn _start() -> ! {
    // 'k'
    print("kernel\n");
    loop {}
}

fn print(s: &str) {
    let mut bytes = s.bytes();
    while let Some(b) = bytes.next() {
        unsafe {core::arch::asm!(
            "out dx, al"
            , in("al") b
        )};
    };
}

#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
    print("panicked");
    loop {}
}