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.
In this section, we give an overview of notable changes to the projects hosted under 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:
- Provide null segment selector as associated constant on SegmentSelector
- Correct wrong comment
- Fix align functions
- Cleanup Segment macros
- Update comment and docs
Thanks to @prinzdezibel for their contribution!
We also merged two updates into the
next branch for the upcoming
uefi crate provides safe and performant wrappers for UEFI, the successor to the BIOS.
We merged the following changes in April:
- Add support to get the file path of loaded image
FilePathMediaDevicePath(and a bunch of supporting code)
- Improve device path API
- Fix undefined behavior in
- Fix potential undefined behavior in file info
- Fix off-by-one test error
CI and linting
- Add changelog entries for recent PRs
- Add documentation on why
UnsafeCellis used for protocols
- Add documentation links for
bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following changes:
We also made some good progress on the upcoming
v0.11 version of the crate:
- Replace artifact dependency with build script
- Add function to create UEFI disk image to library
- Adjust and merge PR #219 into next
- Integrate latest changes from
- Update test framework to rewrite
- Merge PR #229 into next and adjust it to new config system
- Remove uefi dependency of common crate
- Start integrating BIOS bootloader into build system
- Simplify MBR code and choose bootable partition
- Refactor FAT creation function to take arbitrary file list
- Integrate BIOS bootsector into build system
- Build and load a second stage
- Use pie relocation model for second stage
- Clean up boot sector code
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 crate provides abstraction types for the multiboot information structure (MBI) of multiboot2
bootloaders. The latest release of the
multiboot2-crate is now
v0.13.1). It contains minor
improvements, such as that
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.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
Maintained by @phil-opp
uart_16550 crate provides basic support for serial port I/O for 16550-compatible UARTs. We merged the following change this month:
- Remove use of
nightlyfeatures (published as
Thanks to @josephlr for this contribution!
Maintained by @phil-opp
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:
- Remove the const_generics feature flag (published as
Thanks to @hawkw for this contribution!
Maintained by @toku-sa-n
xhci crate provides types of xHCI structires, 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.
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.
(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 -----------------------------------------------------------
(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.
(Section written by @phil-opp)
We merged the following improvements for the "Writing an OS in Rust" blog this in April:
For the current status of the upcoming third edition, see my comment on the related GitHub issue.
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 gitter channel.