Rust OSDev Operating System Development in Rust

This Month in Rust OSDev: April 2022

Welcome to a new issue of "This Month in Rust OSDev". In these posts, we give a regular overview of notable changes in the Rust operating system development ecosystem.

This series is openly developed on GitHub. Feel free to open pull requests there with content you would like to see in the next issue. If you find some issues on this page, please report them by creating an issue or using our comment form at the bottom of this page.

Project Updates

In this section, we give an overview of notable changes to the projects hosted under the rust-osdev organization.

x86_64

Maintained by @phil-opp, @josephlr, @Freax13, and @rybot666

The x86_64 crate provides various abstractions for x86_64 systems, including wrappers for CPU instructions, access to processor-specific registers, and abstraction types for architecture-specific structures such as page tables and descriptor tables.

In April, we merged the following improvements and fixes:

Thanks to @prinzdezibel for their contribution!

We also merged two updates into the next branch for the upcoming v0.15 release:

uefi-rs

Maintained by @GabrielMajeri and @nicholasbishop

The uefi crate provides safe and performant wrappers for UEFI, the successor to the BIOS.

We merged the following changes in April:

Features

Bug fixes

CI and linting

Documentation improvements

Thanks to @supdrewin, @nicholasbishop and @raccog for their contributions!

bootloader

Maintained by @phil-opp, @rybot666, and @64

The bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following changes:

Thanks to @Freax13 and @toothbrush7777777 for these contributions!

We also made some good progress on the upcoming v0.11 version of the crate:

The next steps now are: setting up unreal mode on the CPU, loading the kernel from the FAT partition, loading the memory map, and setting up the page tables.

multiboot2

Maintained by @IsaacWoods, @phip1611, @robert-w-gries, @ahmedcharles, and @Caduser2020

The multiboot2 crate provides abstraction types for the multiboot information structure (MBI) of multiboot2 bootloaders. The latest release of the multiboot2-crate is now v.0.13.2 (was v0.13.1). It contains minor improvements, such as that TagType implements Ord.

multboot2-header

Maintained by @IsaacWoods, @phip1611, @robert-w-gries, @ahmedcharles, and @Caduser2020

The multiboot2-header crate provides abstraction types for Multiboot2 headers and a builder struct to construct such headers. The latest release of the multiboot2-header-crate is now v0.2.0 (was v0.1.0). The changes include a bugfix that prevented the usage in no_std contexts. Furthermore, overall code quality was improved. The internal CI was updated to verify no_std builds as well as regular builds. Full changelog: https://github.com/rust-osdev/multiboot2/releases/tag/multiboot2-header-v0.2.0

uart_16550

Maintained by @phil-opp

The uart_16550 crate provides basic support for serial port I/O for 16550-compatible UARTs. We merged the following change this month:

Thanks to @josephlr for this contribution!

volatile

Maintained by @phil-opp

The volatile crate provides a safe wrapper type for implementing volatile read and write operations. This is useful for accessing memory regions that have side-effects, such as memory-mapped hardware registers or framebuffers. In April, we merged the following pull request:

Thanks to @hawkw for this contribution!

xhci

Maintained by @toku-sa-n

The xhci crate provides types of xHCI structures, such as Registers and TRBs.

In this month, we released a new version 0.8.3 which includes a bug fix reported and committed by @Yuna-Tomi. The bug was that EventRingDequeuePointerRegister::event_ring_dequeue_pointer() did not return the correct address. Thanks for the contribution!.

Call for Participation

Want to contribute to a Rust OSDev project, but don't know where to start? Pick up one of these outstanding issues in one of our projects and get started!

If you maintain a Rust project related to operating system development and are looking for contributors, especially for tasks suited to people getting started in this space, please create a PR against the next branch with the tasks you want to include in the next issue.

Other Projects

In this section, we describe updates to Rust OS projects that are not directly related to the rust-osdev organization. Feel free to create a pull request with the updates of your OS project for the next post.

rust-embedded/rust-raspberrypi-OS-tutorials

(Section written by @andre-richter)

The Operating System development tutorials in Rust on the Raspberry Pi project saw two more tutorial releases:

The two tutorials implement the generation of backtraces that show address and symbol information. Here is an example of the of a backtrace generated as part of the kernel's panic handler:

[    0.002782] Writing to bottom of address space to address 1 GiB...
[    0.004623] Kernel panic!

Panic location:
      File 'kernel/src/_arch/aarch64/exception.rs', line 59, column 5

[...]

Backtrace:
      ----------------------------------------------------------
          Address            Function containing address
      ----------------------------------------------------------
       1. ffffffffc0001294 | core::fmt::write
       2. ffffffffc0005560 | libkernel::panic_wait::_panic_print
       3. ffffffffc00054a0 | rust_begin_unwind
       4. ffffffffc0002950 | core::panicking::panic_fmt
       5. ffffffffc0004898 | current_elx_synchronous
       6. ffffffffc0000a74 | __vector_current_elx_synchronous
       7. ffffffffc000111c | kernel_init
      -----------------------------------------------------------

metta-systems/vesper

(Section written by @berkus)

Vesper is a capability-based single-address-space nanokernel. This means it is aiming to be small, to provide only isolation primitives; at the same time SAS makes it a lot easier to perform cross-process operations (because all addresses are the same across all processes). It uses capabilities to provide security for such operations, so that unauthorized processes will not be able to intervene in legitimate traffic.

The kernel is in very early stages of development. This time I will update on the progress of tooling and my next steps. As usual, I will link directly to my blog for more details. Read the full article here.

phil-opp/blog_os

(Section written by @phil-opp)

We merged the following improvements for the "Writing an OS in Rust" blog this in April:

Thanks to @JOE1994, @QuqqU, @ruhuang2001, and @PoorlyDefinedBehaviour for their contributions!

For the current status of the upcoming third edition, see my comment on the related GitHub issue.

Join Us?

Are you interested in Rust-based operating system development? Our rust-osdev organization is always open to new members and new projects. Just let us know if you want to join! A good way for getting in touch is our Zulip chat.

Comments