This Month in Rust OSDev (May 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.
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 May, we merged the following changes:
- Use new
const_fn_trait_boundfeature to fix build on latest nightly (published asv0.14.1) - Multiple improvements to the inline assembly code (published as
v0.14.2) - Minor lint fixes
- Cleanup
const_fn! - Use marker types for Port read/write access
- Bump version to 0.14.3 (published as
v0.14.3)
We also started to prepare a v0.15 release, for which we already implemented the following breaking changes:
- Replace
software_interrupt!macro with generic function software_interrupt: Add additional testing- Fix typo in docs
- idt: Fixup Options structure and cleanup
set_handler_fn(resubmitted in #261) - Use SegmentSelector in InterruptStackFrame
Thanks to @dbeckwith and @Freax13 for their contributions!
bootloader
The bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following changes:
- Change register used in setting
SSinstage_4(published asv0.10.3) - Fix build on latest Rust nightly by updating to
uefiv0.9.0 - Fix higher half kernels by identity mapping context switch fn earlier (published as
v0.10.4) - Make bootloader v0.10 compatible with latest Rust nightlies by updating uefi-rs dependency (published as
v0.10.5) - Add some usage examples
- Uefi: Look for an ACPI2 RSDP first
- Identity-map GDT into kernel address space
- Don't check target architecture for builder crate to support cross-compiling (published as
v0.10.6)
Thanks to @Elekrisk for their contribution!
We also published the following backport to v0.9:
- Fix nightly regression by manually passing
--gc-sections(published asv0.9.18)
uefi-rs
The uefi crate provides safe and performant wrappers for UEFI, the successor to the BIOS. In May, we merged the following changes:
- Switch to the newer
Trytrait API - Add
FromResidual<Result<!, Error>>impl forStatus - Add
PartitionInfoprotocol - Add shim lock protocol
Thanks to @phil-opp and @nicholasbishop for their contributions!
uart_16550
The uart_16550 crate provides basic support for serial port I/O for 16550-compatible UARTs. We merged the following changes this month:
- SerialPort::new() no longer requires nightly (published as
v0.2.14) - Add support for memory mapped UARTs
- Improvements to new MMIO support (published as
v0.2.15)
Thanks to @josephlr and @remimimimi for their contributions!
pic_8259
The pic_8259 crate provides abstractions for 8259 and 8259A Programmable Interrupt Controllers (PICs). It is a new fork of the pic8259_simple crate, which appears to be no longer maintained.
We merged the following changes on top of the original pic8259_simple crate:
- PIC: Masks
- cpuio: Use new feature flag for const functions
- Replace
cpuiodependency withx86_64crate - Rename to pic8259 and bump version to 0.10.0
Thanks to @mkroening and @hanmertens for their contributions!
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 was fairly quiet, but an important regression was fixed. When native methods were introduced in March,
AmlContext lost its Send + Sync, as these native methods weren't required to be thread-safe. This meant that
AmlContext could no longer be stored in types such as spin::Once, or shared between threads/tasks. This is
undesirable for AmlContext, as it is very expensive to construct, and AML does (in theory) provide mechanisms to
make itself thread-safe, so any probject should only need one.
This was fixed by requiring native methods to be Send + Sync. If you're hitting this issue, please upgrade to the
latest version. (published as v0.13.0)
Thanks to @michaelmelanson for his contribution!
xhci
The xhci crate provides types of xHCI structures such as Contexts, Extended Capabilities, Registers, and TRBs.
In May we finished implementing all of these structures and field getters/setters. Still there may exist missing. If you find one, feel free to send a PR!
spinning_top
The spinning_top crate provides a simple spinlock implementation based on the abstractions of the lock_api crate. This month, we released version v0.2.4 with the following small improvements:
Thanks to @toku-sa-n for these contributions!
vga
The work-in-progress vga crate allows the configuration of the VGA hardware, e.g. switching from text-based mode to a pixel-based graphics mode. This month, we fixed a nightly build error:
- Update dependencies to latest versions to fix E0557
- Update testing (published as
v0.2.7)
Thanks to @ethindp for their contribution!
ps2-mouse
The ps2-mouse library provides a basic interface for interacting with a PS/2 mouse. It was also affected by the nightly breakage in x86_64, so it required a dependency update too:
- Update x86_64 to 0.14.2 (published as
v0.1.4)
Thanks to @littledivy for this 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!
- (
acpi) Add initial support forDefExternalopcodes - (
acpi) Add test to make sureAmlContextremainsSend + Sync
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)
We merged the following improvements to the Writing an OS in Rust blog this month:
- Update posts to fix build on latest nightly
- Update x86_64 dependency to v0.14.2 to fix nightly breakage
- Adjust
post-XXtags for x86_64 v0.14:post-05,post-06,post-07,post-08 - Switch to
pic8259fork - Update
linked_list_allocatordependency to v0.9.0
- Translate post 08 to Japanese
- Remove wrong suggestion part
- Fix typo
- Fix typos in edition 3 uefi booting post
Thanks to @woodyZootopia, @kahirokunn, @HKalbasi, and @bjorn3 for their contributions!
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.