This Month in Rust OSDev: January 2025
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.
Announcements, News, and Blog Posts
Here we collect news, blog posts, etc. related to OS development in Rust.
- Podcast: Rust in Production: Volvo Ships Memory-Safe ECUs in Production Cars
- The VEKOS operating system is now able to execute programs
- Video: Windows Kernel Programming with Rust - Matthias Heiden | EuroRust 2024
- Understanding the Microsoft Pluton security processor (uses Rust and TockOS)
- Linux: Resistance to Rust abstractions for DMA mapping
Infrastructure and Tooling
In this section, we collect recent updates to rustc
, cargo
, and other tooling that are relevant to Rust OS development.
- Insert null checks for pointer dereferences when debug assertions are enabled
- Make missing_abi lint warn-by-default
- show linker output even if the linker succeeds
rust-osdev
Projects
In this section, we give an overview of notable changes to the projects hosted under the rust-osdev
organization.
uefi-rs
Maintained by @GabrielMajeri, @nicholasbishop, and @phip1611
uefi
makes it easy to develop Rust software that leverages safe, convenient,
and performant abstractions for UEFI functionality.
We merged the following PRs this month:
- uefi-raw: Add FirmwareVolume{,Block}2Protocol
- uefi-raw: hii: Add Database Protocol
- uefi-raw: Add ScsiIoProtocol
- Add missing type/subtype checks to
TryFrom<&DevicePathNode>
- uefi-raw: Add common impls for http types
- relicensing: Rewrite allocator, configuration table, and image unload PRs
- relicensing: Rewrite set_timer PR
- Fix memory leaks in DevicePathFromText
- Add warning to custom memory types
- test-runner: Clean up device path tests
Thanks to @crawfxrd and @hannahfluch for their contributions!
bootloader
Maintained by @phil-opp and @Freax13
The bootloader
crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following improvements:
- use threads instead of futures in build.rs
- Move test kernels to a separate workspace
- fix condition for running bootloader common tests
x86_64
Maintained by @phil-opp, @josephlr, and @Freax13
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.
We merged the following PRs this month:
- fix warnings & remove broken CI job
- Add page attribute table support
- use default python again
- feat(msr): add IA32_APIC_BASE support
Thanks to @hannahfluch and @adavis628 for their contributions!
acpi
Maintained by @IsaacWoods
The acpi
repository contains crates for parsing the ACPI tables – data structures that the firmware of modern computers use to relay information about the hardware to the OS. We merged the following changes this month:
- acpi: Remove Clone Copy traits for MADT
- acpi: Clone impl for PlatformInfo and ManagedSlice
- aml: fix clippy warnings and run clippy in CI
- Fix unsoundness in our representation of the MADT
Thanks to @IsaacWoods, @mrjbom, and @00xc for their contributions!
multiboot2
Maintained by @phip1611
Convenient and safe parsing of Multiboot2 Boot Information (MBI) structures and the contained information tags. Usable in no_std environments, such as a kernel. An optional builder feature also allows the construction of the corresponding structures.
We merged the following PRs this month:
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.
roeeshoshani/genesis
(Section written by @roeeshoshani)
genesis
is a bare metal firmware implementation for mips. it implements everything from the bottom up, from
initializing the cpu caches, to configuring pci devices and the interrupt controller.
this month, the core async executor was implemented.
this means that we can implement blocking operations (for example reading a byte from the UART) as rust futures, and we then
.await
them.
this makes our lives much easier when writing code that needs to block until some I/O events happen. instead of using callbacks,
and having to pass our state all over the place, we can just .await
the blocking future, and write our code using async functions,
which is much more ergonomic.
example
currently, there is only one blocking operation implemented, the operation of reading a byte from the UART.
this allows code like the following to be written:
loop {
let byte = uart_read_byte().await;
println!("received uart byte: {}", byte);
}
which is a huge improvement over the previous implementation of putting the code inside the UART interrupt handler.
how does it work?
the way this works is that the core kernel's main loop looks roughly like the following:
loop {
poll_tasks();
wait_for_interrupt();
}
then, the interrupt handler is responsible for waking up the relevant tasks.
futures that need interrupt handlers to wake them up should somehow register themselves, and the interrupt hanlers will then wake the registered tasks.
then, in the next iteration, the tasks that were woken up will be polled again, which completes the loop.
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.