summaryrefslogtreecommitdiff
path: root/kernel/src/lib.rs
blob: adf14b48de10c5a3e1851ddfa05c6d3f730ad5eb (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
28
29
30
31
32
33
34
35
36
37
#![no_main]
#![feature(compiler_builtins_lib)]
#![feature(custom_test_frameworks)]
#![feature(abi_x86_interrupt)]
#![feature(panic_info_message)]
#![feature(asm)]
#![test_runner(crate::testing::serial_test_runner)]
#![reexport_test_harness_main = "test_main"]
#![no_std]

pub mod interrupts;
pub mod io;
pub mod testing;

pub use io::qemu::{exit_qemu, QemuExitCode};
pub use io::vga_text::OStream;
pub use io::{qemu, serial, vga_text};
pub use qemu::*;

#[cfg(test)]
#[no_mangle]
pub extern "C" fn _start() -> ! {
    init();
    test_main();
    loop {}
}

#[cfg(test)]
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
    testing::serial_panic(info)
}

pub fn init() {
    interrupts::gdt::init();
    interrupts::idt::init();
}