ethandmd / reedos

rust riscv minimal os
2 stars 6 forks source link
embedded kernel operating-systems osdev qemu risc-v rust

reedos

You could say reed-oh-ESS, but we've been saying rEE-doss.

See Contribution Guidelines if you're interested in getting involved.

Notes

We currently support Rust's GlobalAlloc in order to use the alloc crate. We do so by wrapping page allocation and finer grained virtual memory allocation into a Global Allocator struct which implements Rust's GlobalAlloc trait. As an example, this is valid reedos kernel code:

use alloc::collections;
{
    // Simple test. It works!
    let mut one = Box::new(5);

    // Slightly more interesting... it also works! Look at this with GDB
    // and watch for the zone headers + chunk headers indicating 'in use' and
    // 'chunk size'. Then watch the headers as these go out of scope.
    let mut one_vec: Box<collections::VecDeque<u32>> = Box::default();
    one_vec.push_back(555);
    one_vec.push_front(111);
}

{
    // Now, more than a page.
    let mut big: Box<[u64; 513]> = Box::new([0x8BADF00D; 513]);
}

Setup

In order to get started with this project you'll need the following:

If you have Nix installed, you should be able to get all of these by running nix develop (can be automatically loaded when you enter the directory if you have direnv).

Usage

Pretty much everything can be done through cargo now: Cargo Make Description
cargo build make build build (output is target/<ARCH>/<PROFILE>/reedos)
cargo run make qemu build and run with QEMU
DEBUG=1 cargo run make qemu-gdb build and run with QEMU (wait for gdb)
cargo doc --open make docs build and open documentation in a browser
cargo clean make clean remove target/ directory

You can exit QEMU by pressing Ctrl + a, then x.

Debug tools

You may find the following debug tools (that you have mostly already installed) helpful:

Docs

References