Rust OSDev Operating System Development in Rust

This Month in Rust OSDev (February 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.

uefi-rs

The uefi crate provides safe and performant wrappers for UEFI, the successor to the BIOS. In February, we merged the following changes:

Thanks to @gil0mendes, @sreehax, and @avirule 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 February, the unstable const_in_array_repeat_expressions feature was removed from Rust because it implicitly changed drop behavior. This lead to a compile error of the x86_64 crate because it still had that feature enabled. Interestingly, we no longer needed this feature after #175 (and an accidental stabilization in Rust), so the fix was quite simple:

Thanks to @KernelFreeze for this contribution!

bootloader

The bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged two small updates to fix build errors and warnings on newer Rust nightlies:

Thanks to @dspencer12 for their contribution!

There was also some more progress on the uefi branch, which contains the upcoming new bootloader version with UEFI support:

The UEFI rewrite is almost done, but we still need to update the docs, improve the configurability of the framebuffer, and add more testing.

uart_16550

The uart_16550 crate provides basic support for serial port I/O for 16550-compatible UARTs. Since the crate also depends on x86_64, it needed a dependency update to fix the mentioned build error on the latest nightly:

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. The nightly build error of x86_64 also affected this crate, so it needed a fix too:

Thanks to @Pollux3737 for this contribution!

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 updates this month:

Thanks to @MHBahrampour, @garasubo, @dspencer12, @toku-sa-n, and @16yuki0702 for their contributions!

I also made some progress on the upcoming third edition. Some potentially interesting commits are:

cdrzewiecki/celos

(Section written by @drzewiec)

I have been working on an OS following along with @phil-opp's tutorial series for a while, but recently decided I would rework my OS based on the first edition of the blog (since I preferred to use GRUB as my bootloader). This is the first progress I have to share on CelOS, and indeed the first time I've published one of these updates in general.

In February, I made a lot of great progress on CelOS. I have the complete physical memory (plus the framebuffer provided by GRUB) mapped to virtual memory, and a pixel-based framebuffer working with text output. Things are not very optimized right now (for one thing I'm stretching the font8x8 font into 8x12), but this is a great first step that I can build on. Next planned steps are:

  • Move the kernel in virtual memory so that it occupies the higher half of the 48-bit address space
  • Create some page fault interrupt handling so that the kernel can at least attempt to handle page faults (rather than triple faulting as it does now)
  • Set up memory allocation for the kernel, to get heap allocation
  • Once heap allocation is in place, utilize some existing crate to handle TrueType fonts so that text will look a bit nicer on screen

I probably won't get all of that done in March, but those are my planned next steps. Thanks to this great community and to @phil-opp for being so helpful in the osdev journey!

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.

Comments