This Month in Rust OSDev (August 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.
There was a fair amount of progress this month, including adding support for a major AML feature: buffer fields.
These are objects that represent bit-level slices of buffer objects, allowing a section of a buffer to be read and
written. This requires us to support multiple namespace objects operating on the same underlying data -
currently this is handled simply with spinlocks, but we're looking to improve this situation in the future.
With this, we grew support for the DefCreateBitField
, DefCreateByteField
, DefCreateWordField
,
DefCreateDWordField
, DefCreateQWordField
, and DefCreateField
opcodes, as well as logic for reading and
writing Integer
s and Buffer
s out of them. (published as aml v0.16.0
)
The acpi
crate also saw improvement, and unfortunately some more breakage. We now support X2APIC entries
appearing in the MADT, and so have changed the representation of Processor UIDs and Local APIC IDs in
acpi::platform::Processor
to u32
, to support the wider IDs that X2APIC uses to support more processors. On
older platforms that only support APIC, the upper bits will simply always be zeroed, and so these values can be
cast down to u8
when needed. Note that for complex legacy reasons, you cannot rely upon ACPI for detecting
whether a platform has X2APIC support or not, and so whether the MADT actually contained X2APIC entries is not exposed
by this interface - this is by design. (published as acpi v4.0.0
)
Other changes were:
aml
: the contents of thenamespace
module were made public. Thanks to @Andy-Python-Programmer for this contribution!aml
: store locals and method arguments in arrays. If you're manually calling AML methods that take arguments, you will need to update how you create them.aml
: support theDefFatal
opcode.DefFatal
will cause a panic by default, but this behaviour can be overridden by implementingHandler::handle_fatal_error
.aml
: implement theDefWhile
opcodeaml
: implement theDefBreak
opcodeaml
: implement theDefContinue
opcodeaml
: implement theDefIncrement
andDefDecrement
opcodesaml
: implement theToInteger
opcode
uefi-rs
The uefi
crate provides safe and performant wrappers for UEFI, the successor to the BIOS.
In August, @nicholasbishop joined as a co-maintainer of the crate. Welcome!
Many improvements were merged this month:
- Add
BootServices::exit
method; MakePointerMode
's fields public for checking against support of a pointer device - Implement
PartialEq
+Eq
forDevicePath
- System table can get debug-formatted
- loaded image: add set_image function
- Better
CStr16
toString
andstr
conversions - Add a minimal UEFI application template
- Use the built-in
aarch64-unknown-uefi
target - Make
GraphicsOutput.query_mode(...)
public - Publish new versions of all the crates (published
uefi v0.12.0
,uefi-macros v0.4.0
, anduefi-services v0.9.0
) - Add newtype enum for variable vendors and add
IMAGE_SECURITY_DATABASE
to it - Fix doc link and make CI lints stricter
- Add num_bytes method to
CStr16
- Add
CString16
- Enhance
Guid::from_values
andGuid::fmt
- Handle panics by unwinding the stack and implement check_event method
Thanks to @HTG-YT, @phip1611, @Andy-Python-Programmer, and @timrobertsdev 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 August, we merged the following changes:
- Rename
XCr0
andCR4
flags - Fix CI tests on Windows
- Use
#[cfg(doc)]
instead of docs.rs-specific cfg flag - Expose
MapperFlush::new
andMapperFlushAll::new
- docs: Update segment register references in
GDT::load*
method to non-deprecated methods - docs(idt): remove a panic note
- Fix typo and doc links in GDT docs
These changes were not published yet, but a pull request for a new version is open already: Release version 0.14.5.
Thanks to @toku-sa-n and @ncatelli 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:
- [v0.9] Set
relocation-model: static
andpanic-strategy: abort
and fix.intel_syntax
warnings (published asv0.9.19
) - Fix relocation-model field name in the target spec json (published as
v0.10.7
) - Pad uefi fat file length
- Also check cfg gated target field for bootloader dependency (published as
v0.10.8
) - Fix typo in link in changelog
Thanks to @vinc, @bjorn3, @Freax13, @yusdacra, and @martica for their contributions!
multboot2
The multiboot2
crate provides abstraction types for the boot information of multiboot2 bootloaders.
The following changes were merged this month:
- Unpublic tags bugfix (published as
v0.12.1
) - Fix
ModuleTag
cmdline - Stricter typing + better split of modules + bugfix
pic_8259
The pic_8259
crate provides abstractions for 8259 and 8259A Programmable Interrupt Controllers (PICs).
In August, we added cargo features to make the crate buildable on stable:
- Add
nightly
andstable
feature flags to enable compilation on stable Rust (published asv0.10.2
)
Thanks to @toku-sa-n 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!
No tasks were proposed for this section.
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:
- Update crate versions across translations
- Replace MS doc link that linked to a German page
- Fix link: The const_fn unstable feature no longer exists
- Replace fathom analytics with goatcounter
- fix: typo
- Fix links in Russian translation
Thanks to @Foo-x, @adi-g15, @Kalbiq, and @non-descriptive 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.