This Month in Rust OSDev (December 2020)
Welcome to a new issue of "This Month in Rust OSDev". In these posts, we will 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 new comment form at the bottom of this page.
In this section, we give an overview of notable changes to the projects hosted under 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 December, we published the following three new releases:
- Add and fix some intra-doc links
- GDT: Add
- Fix bad conversion from llvm_asm! to asm!
- Also return flags for
- Restructure the
TranslateResulttype and create separate
- Use custom error types instead of
- Remove deprecated items:
- Change return type of
- Make writing the RFLAGS register unsafe)
PortReadWritetrait, which is no longer needed)
Thanks to @mental32, @vinaychandra, @tomaka, @haraldh, @tscs37, and @toku-sa-n for their contributions!
volatile crate provides a safe wrapper type for implementing volatile read and write operations. This is useful for accessing memory regions that have side-effects, such as memory-mapped hardware registers or framebuffers. In December, we added to new methods for creating read/write-only
- Add methods to restrict access (published as
bootimage tool allows the creation of bootable disk images for
bootloader-based kernels. It also provides a runner executable for
cargo to make
cargo run and
cargo test work using QEMU. This month, we fixed a nightly breakage:
- Fix nightly breakage of doctests in workspaces (published as
cargo-xbuild project provides
cargo command wrappers to cross-compile the sysroot crates
alloc. This month, we merged a small error reporting improvement:
- Don't panic on metadata errors (published as
Thanks to @parasyte for this contribution!
Even though we still maintain the
cargo-xbuild crate, we recommend switching to cargo's own
build-std feature that is always up-to-date with the latest Rust/Cargo changes. We wrote a short guide on how to switch to it, which is available in our Readme.
bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. In December, we merged the following changes:
Thanks to @Luis-Hebendanz for their contribution!
uefi crate provides safe and performant wrappers for UEFI, the successor to the BIOS. In December, we merged the following changes:
- Clarify how new protocols can be defined
- Add support for the device path protocol
- Fix breakage with the latest nightlies
- Publish new versions of the crates
Thanks to @avirule for their contribution!
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. In December, we:
- Exposed the Power Management Timer, part of the ACPI hardware platform. Thanks to @toku-sa-n for their contribution!
- Improved the behaviour of the BIOS RSDP search algorithm. If
you're coming across the same problem as the reporter, try updating to
- Improved codegen for the
choice!macro. This fixes limitations in how large parsers can get before they break
rustc's type limit. The new version allows better ergonomics, but also generates much less work for the type checker and so speeds up the compilation of the
- Fixed a few bugs in the handling of
DefPackageobjects (1, 2, 3).
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.
(Section written by @phil-opp)
We merged the following changes to the Writing an OS in Rust blog this month:
- Translate post-03 to Japanese
- Rename edition folders
- Minor grammar fixes
- Add filepath to code block
- Fix broken QEMU link
Thanks to @woodyZootopia, @JohnTitor, @delta1, and @16yuki0702 for their contributions!
Last month, I mentioned that I'm working on a new revision of the blog with support for UEFI booting, a pixel-based framebuffer, and the APIC interrupt controller. I also mentioned that the Cargo team approved my proposal to replicate some
cargo/config settings in the
Cargo.toml, which will be required for the new build system of the blog. In December, we now saw the first pull request based on this proposal: Expose build.target .cargo/config setting as packages.target in Cargo.toml. Thanks a lot to @Ekleog for tackling this!
While I had planned the new revision for a long time already, there was still one open question: Should I integrate the changes into the second edition or start a new, third edition of the blog? Originally, I tended to integrate the changes into the second edition since a new edition is a lot of work and only a few posts would require substantial changes anyway. However, the recent translation efforts by many great people (thanks to all contributors!) have changed my mind on this because I don't want to throw away any of their work. For this reason I decided to start working on a new, third edition of the blog 🎉!
Apart from the changes mentioned above, the new edition will have some additional "fun" posts at the start that show how to create a simple shell and some basic games (instead of directly jumping into interrupt handling and memory management). In addition to the Testing post we already have, there will be some posts about debugging with GDB and QEMU. There will also be some design improvements such as a refreshed index page and a dark mode. I hope you like these ideas and I look forward to releasing a first draft of the new edition soon!
(Section written by @phil-opp)
linked_list_allocator crate provides a simple heap allocator that is usable on
no_std systems. It keeps track of free memory blocks by turning them into a linked list data structure.
In December, the crate received the following updates:
- Use new nightly Allocator trait
- Build on stable without features (published as
- Fix: do not require alloc crate (published as
- Don't require nightly for
use_spinfeature (published as
- Make hole module public for external uses (published as
- Add new use_spin_nightly feature (published as
Thanks to @haraldh, @MarcoCicognani, and @thalesfragoso for their contributions!.
(Section written by @lucis-fluxum)
I pushed release v0.1.1 this month, which is mainly a documentation update aiming to improve understanding of how to use the library. I've also added links to some reading material that helped me understand the PS/2 protocol better and much of the surrounding terminology. May the old keyboards live on!
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 gitter channel.