This Month in Rust OSDev: May 2024
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.
- This Month in Redox - May 2024: Redox is running COSMIC file manager, editor, and terminal now
- Bachelor's Thesis: Writing an NVMe Driver in Rust (PDF)
- Building an Async Runtime for the Windows Kernel
- Ferrocene 24.05.0 now available for purchase
- Rust 1.78: Performance Impact of the 128-bit Memory Alignment Fix
- GxHash - an extremely fast hardware-accelerated non-cryptographic hashing algorithm (zero dependencies, no_std compatible)
- The Embedded Rustacean Issue #19, Issue #20, and Issue #21
Infrastructure and Tooling
In this section, we collect recent updates to rustc
, cargo
, and other tooling that are relevant to Rust OS development.
- Stabilize
LazyCell
andLazyLock
(LazyCell
is available inno_std
) - Stabilize
error_in_core
- Add
x86_64-unknown-linux-none
target (freestanding linux binaries withoutlibc
dependency) - Add
opt-for-size
core lib feature flag - Implement feature
integer_sign_cast
rust-osdev
Projects
In this section, we give an overview of notable changes to the projects hosted under the rust-osdev
organization.
endian-num
(new project!)
Maintained by @mkroening
The endian-num
crate provides the Be
(big-endian) and Le
(little-endian) byte-order-aware numeric types.
- initial implementation
- docs: elaborate on differences to other crates
- docs: refer to related crates via docs.rs
Thanks to @mkroening for creating and maintaining this crate!
uefi-rs
Maintained by @GabrielMajeri, @nicholasbishop, and @phip1611
The uefi-rs
crate provides safe and performant wrappers for UEFI, the successor to the BIOS. We merged the following PRs this month:
- Fix risc target_arch cfg
- Match MaximumCapsuleSize to UEFI spec
- Add RuntimeServices::update_capsule
- Add RuntimeServices::query_capsule_capabilities
- Note about feature flags for uefi book
- uefi-raw: misc
- mem: clarify confusion around MemoryDescriptor
- uefi/helpers: logger logs to debugcon device
- Add basic API for a global system table
- uefi: BootServices::allocate_pool now returns NonZero
instead of *mut u8 - Fix uefi-macros trybuild test
Thanks to @stillinbeta and @andre-braga 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:
- Fix doc comment and error message only referencing the BIOS but used for UEFI
- Ensure all page table frames are mapped as writable
Thanks to @fmckeogh and @Wasabi375 for their contributions!
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 cfg related warnings
- merge master into next
- add Mapper::clear to clear any page table entry regardless of present flag
- fix warnings
Thanks to @Wasabi375 for their contribution!
multiboot2
Maintained by @phip1611
The multiboot2
crate provides abstraction types for the multiboot information structure (MBI) of multiboot2 bootloaders. We merged the following changes this month:
- multiboot2: builder: Allow to specify SMBIOS tag multiple times
- dev: misc improvements
- release
- multiboot2: fix handling of efi memory map
Thanks to @YtvwlD for their contribution!
linked-list-allocator
Maintained by @phil-opp and @jamesmunns
The linked-list-allocator
crate provides a basic no_std
allocator that builds a linked list from freed memory blocks and thus needs no additional data structures. We merged the following PR 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.
mkroening/free-list
(Section written by @mkroening)
The free-list
crate provides the FreeList
type for managing virtual or physical memory.
Opposed to normal memory allocators, FreeList
does not use pointers but page ranges.
It operates by keeping a list of free page ranges (hence the name) and allows allocating at user-provided ranges.
Instead of operating directly on the unallocated memory through a linked list, this free list uses statically allocated memory before dynamically allocating more memory to hold its elements.
use free_list::{FreeList, PageLayout};
let mut free_list = FreeList::<16>::new();
unsafe {
free_list.deallocate((0x1000..0x5000).try_into().unwrap()).unwrap();
}
assert_eq!(free_list.free_space(), 0x4000);
let layout = PageLayout::from_size(0x4000).unwrap();
assert_eq!(free_list.allocate(layout).unwrap(), (0x1000..0x5000).try_into().unwrap());
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.