Philipp Oppermann's awesome [Writing an OS in Rust]
Current main.rs:
```rust
extern crate bootloader; extern crate rustos; use bootloader::{entry_point, BootInfo}; use core::panic::PanicInfo; use rustos::{println, task};
entrypoint!(startkernel);
fn startkernel(bootinfo: &'static BootInfo) -> ! { println!("Welcome to the real world!");
// Initialize the kernel.
rustos::init();
rustos::memory::init(boot_info);
// Run async tasks.
let mut executor = task::Executor::new();
executor.spawn(task::Task::new(example_task()));
executor.run();
#[cfg(test)]
test_main();
println!("It did not crash!!!");
rustos::hlt_loop()
}
fn panic(info: &PanicInfo) -> ! { println!("{}", info); rustos::hlt_loop(); }
fn panic(info: &PanicInfo) -> ! { rustos::testpanichandler(info) }
async fn exampletask() { let number = asyncnumber().await; println!("async number: {}", number); }
async fn async_number() -> u32 { 42 } ```
You can run the current [main.rs] with make run
:
sh
make run
or the previous posts, e.g. [post01.rs] with make run-post_name
as:
sh
make run-post01
You can run all the integration test with make test
:
sh
make test
or specific tests with `make tsst-test_name as:
sh
make test-heap_allocation
Happy Hackin'!