This Month in Rust OSDev: June 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.
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.
This month, @jamesmunns redesigned the internal API for traversing the linked list in order to pass the strict tests of miri
, which is an experimental interpreter for Rust's intermediate representation (MIR). Among other things, miri
checks that pointers are correctly aligned and that no invalid aliasing occurs (based on different formal models). By checking our implementation against miri
, we make it more robust and reduce the chance that undefined behavior occurs with future compiler versions.
The change was implemented across the following pull requests:
- Refactor with Cursor-based API, and passing Miri tests (published as
v0.10.0
, but yanked later) - (fix(deallocate_middle): advance to next in
try_insert_after
) - Fix free logic (published as
v0.10.1
)
Thanks to @jamesmunns for the redesign and @haraldh for reporting a critical issue in the v0.10.0
release and providing a fix! Also, we would like to welcome @jamesmunns as a maintainer of this crate!
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.14.0
(was
v0.13.2
). It contains some small breaking changes because so far, we used some unsafe code and
relied on having not to verify UTF-8 strings. For a full changelog, please refer to the
GitHub repo.
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 June:
Fixes
Improvements
- Remove unused
From<ucs2::Error>
impls - Remove
eh_personality
lang item - Simplify
uefi-services
panic handler
Internal changes
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 made more progress on the upcoming v0.11
version:
- WIP: try to start loading FAT partition in second stage
- Start custom FAT implementation based on
mini_fat
crate (to keep the executable size down) - Read root dir entries from FAT partition
- Use segment-based addressing for DAP to support loading larger second stages
- Implement looking up
kernel-x86_64
file on FAT partition - Read FAT clusters of kernel file
- Ensure proper alignment of DAP target buffer
- Enter unreal mode
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 June, we merged the following pull request:
- Add
registers::debug
(published asv0.14.10
)
Thanks to @mkroening for this contribution!
cargo-xbuild
Maintained by @phil-opp
The cargo-xbuild
project provides cargo
command wrappers to cross-compile the sysroot crates core
and alloc
. It is mostly useful in situations, where cargo's unstable -Zbuild-std
flag is not usable.
This month, we fixed a build error of the alloc
crate on the latest nightlies:
- Fix: The alloc crate uses the Rust 2021 edition now (published as
v0.6.6
)
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!
-
(
rust-osdev/volatile
) New design based on pointer typesWe are currently discussing a new design for the
volatile
crate based on raw pointer types in order to avoid potential undefined behavior. The linked pull requests proposes an implementation where the volatile wrapper type isCopy
and its methods takeself
by value. We haven't reached a decision yet, so if anyone has more input on this, please join the discussion. For more context, see also PR #22.
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.
google/gpt-disk-rs
(Section written by @nicholasbishop)
gpt-disk-rs
is a collection of three libraries related to GPT (GUID Partition Table) disk data. The crates are no-std by default, have minimal dependencies, and include a lot of documentation. I'm hoping they'll be a suitable base for any project that wants to read or write GPT data.
uguid
: GUID data type.gpt_disk_types
: all the GPT types defined by the UEFI specificationgpt_disk_io
: types for reading and writing GPT data to an abstract block IO device.
vinc/moros
(Section written by @vinc)
MOROS is a text-based hobby operating system targeting computers with a x86-64 architecture and a BIOS. It is inspired by Unix and ITS but is closer to a modern DOS at the moment in term of features.
In the last month I finally managed to run rust programs (without alloc) inside the OS after being limited to nasm programs for a long time. This triggered a lot of refactoring and improvements in the shell and the lisp language used for scripting.
Next step will be publishing a 0.8.0 release and working on userspace allocation.
phil-opp/blog_os
(Section written by @phil-opp)
This month, we merged the following improvements:
- [Translation][Korean] post-03 (edition-2)
- Fix typo in Japanese translation (thanks to @KisaragiEffective)
- Translate the giscus comment system
- Move comment threads for translated posts to separate category
- Remove goatcounter analytics again
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.