52 lines
840 B
Rust
52 lines
840 B
Rust
#![feature(abi_x86_interrupt)]
|
|
#![no_std]
|
|
#![no_main]
|
|
#![feature(custom_test_frameworks)]
|
|
#![test_runner(crate::test_utils::test_runner)]
|
|
#![reexport_test_harness_main = "test_main"]
|
|
|
|
#[macro_use]
|
|
mod vga_buffer;
|
|
#[macro_use]
|
|
mod serial;
|
|
mod gdt;
|
|
mod interrupts;
|
|
mod test_utils;
|
|
|
|
#[cfg(not(test))]
|
|
#[panic_handler]
|
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
|
println!("{info}");
|
|
loop {}
|
|
}
|
|
|
|
#[no_mangle]
|
|
pub extern "C" fn _start() -> ! {
|
|
#[cfg(test)]
|
|
test_main();
|
|
|
|
println!("Gamarjoba, munde!");
|
|
init();
|
|
|
|
// Deliberate breakpoint exception
|
|
x86_64::instructions::interrupts::int3();
|
|
|
|
println!("We're here now");
|
|
loop {}
|
|
}
|
|
|
|
#[test_case]
|
|
fn basic_test() {
|
|
assert_eq!(5, 5);
|
|
}
|
|
|
|
#[test_case]
|
|
fn basic_test2() {
|
|
assert_eq!(4, 4);
|
|
}
|
|
|
|
pub fn init() {
|
|
gdt::init();
|
|
interrupts::init_idt();
|
|
}
|