rustos
Philipp Oppermann's awesome Writing an OS in Rust
- Bare bones
- Interrupts
- Memroy Management
Examples
Current main.rs:
#![no_std]
#![no_main]
#![feature(custom_test_frameworks)]
#![test_runner(rustos::test_runner)]
#![reexport_test_harness_main = "test_main"]
extern crate rustos;
extern crate x86_64;
use core::panic::PanicInfo;
use rustos::println;
#[no_mangle]
pub extern "C" fn _start() -> ! {
println!("Welcome to the real world!");
rustos::init();
use x86_64::registers::control::Cr3;
let (level_4_page_table, _) = Cr3::read();
println!("Level 4 page table at: {:?}", level_4_page_table);
#[cfg(test)]
test_main();
println!("It did not crash!!!");
rustos::hlt_loop();
}
#[cfg(not(test))]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
println!("{}", info);
rustos::hlt_loop();
}
#[cfg(test)]
#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
rustos::test_panic_handler(info)
}
Happy Hackin'!