This Month in Rust OSDev (June 2021)
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.
acpi
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.
This month, both the rsdp
and acpi
crates saw breaking changes. These changes should require minimal work to migrate to;
please file an issue if you encounter any difficulties. (published as rsdp v2.0.0
and acpi v3.0.0
)
- Basic support for the MADT's new Multiprocessor Wakeup Structure was added
PhysicalMapping
now implementsSend
PhysicalMapping
's fields were made private, preventing construction of unsound mappings in safe code. Theunmap_physical_region
method ofAcpiHandler
also lost itsself
type - handlers that usedself
should instead access themselves through thePhysicalMapping::handler
method. This prevents a mapping from being unmapped using a different handler to the one that mapped it.- Accesses to potentially unaligned packed field were fixed.
repr(packed)
structures are very common in OS Dev, and make sure the layout of Rust's structures matches the hardware's. Unfortunately, they can be slightly tricky to work with - creating an unaligned reference is undefined behaviour, and references can transiently be created by, for example, calling a method on an unaligned field of a packed structure (e.g.entry.flags.get_bit(4)
). You can read more about this issue here. acpi::platform
no longer re-exports the contents of itsinterrupt
submodule
Thanks to @wusyong and @Freax13 for their contributions!
uefi-rs
The uefi
crate provides safe and performant wrappers for UEFI, the successor to the BIOS. In June, we merged the following changes:
- Make the
qemu-exit
dependency optional - Fix type of the media field in the
BlockIO
protocol - Use
newtype_enum
forDevicePath
enums - Make
DevicePath
andAcpiDevicePath
unaligned - Derive
Debug
forCharConversionError
- Rename boot services'
memset
toset_mem
- Implement image loading/starting
- Add
num_blocks
method toGptPartitionEntry
ShimLock
protocol usessysv64
function ABI- Make using the
stdio
handles require a mutable ref - Fix AArch64 build
Thanks to @nicholasbishop, @iankronquist and @josephlr for their contributions!
x86_64
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 changes:
- Add common abstractions for x86 Segments
- Specify sysv64 for the calling convention of the external assembly functions
- Make IDT module available on stable Rust
- Fix off-by-one error in GDT
from_raw_slice()
We did not issue a new crates.io release with these changes yet, but we plan to do so soon.
Thanks to @toku-sa-n for their 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!
- New Russian translation needs a reviewer: We're looking for someone that is speaking Russian to review the new Russian translation of @MrZloHex.
If you maintain a Rust OSDev project 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.
Personal Projects
In this section, we describe updates to personal 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.
phil-opp/blog_os
(Section written by @phil-opp)
The Writing an OS in Rust blog received the following changes this month:
- Switch comments from utterances to giscus
- giscus: Use specific search term instead of
og:title
- giscus: Make it possible to set discussion thread manually per post
- Translate
post-12
to Japanese - Lots of smaller improvements and typo fixes: #1021, #1023, #1026, #1028, #1032
Thanks to:
- @kahirokunn for the new Japanese translation,
- @woodyZootopia, @JohnTitor, and @sozysozbot for reviewing this translation, and
- @Foo-x, @tsao-chi, and @conorbros for fixing typos.
Unfortunately, I didn't have time to work on the upcoming third edition this month. I'll try my best to continue working on it soon!
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.