The Helios microkernel June 13, 2022 on Drew DeVault's blog

I’ve been working on a cool project lately that I’d like to introduce you to: the Helios microkernel. Helios is written in Hare and currently targets x86_64, and riscv64 and aarch64 are on the way. It’s very much a work-in-progress: don’t expect to pick this up and start building anything with it today.

A picture of a ThinkPad running Helios, demonstrating userspace memory allocation

Drawing some inspiration from seL4, Helios uses a capability-based design for isolation and security. The kernel offers primitives for allocating physical pages, mapping them into address spaces, and managing tasks, plus features like platform-specific I/O (e.g. reading and writing x86 ports). The entire system is written in Hare, plus some necessary assembly for the platform bits (e.g. configuring the GDT or IDT).

Things are still quite early, but I’m pretty excited about this project. I haven’t had this much fun hacking in some time :) We have several kernel services working, including memory management and virtual address spaces, and I’ve written a couple of simple drivers in userspace (serial and BIOS VGA consoles). Next up is preemptive multi-tasking — we already have interrupts working reliably, including the PIT, so all that’s left for multi-tasking is to actually implement the context switch. I’d like to aim for an seL4-style single-stack system, though some finageling will be required to make that work.

Again, much of the design comes from seL4, but unlike seL4, we intend to build upon this kernel and develop a userspace as well. Each of the planned components is named after celestial bodies, getting further from the sun as they get higher-level:

A few other components are planned — “Vulcan” is the userspace kernel testing framework, named for the (now disproved) hypothetical planet between Mercury and the Sun, and “Luna” is the planned POSIX compatibility layer. One of the goals is to be practical for use on real-world hardware. I’ve been testing it continuously on my ThinkPads to ensure real-world hardware support, and I plan on writing drivers for its devices — Intel HD graphics, HD Audio, and Intel Gigabit Ethernet at the least. A basic AMD graphics driver is also likely to appear, and perhaps drivers for some SoC’s, like Raspberry Pi’s VideoCore. I have some neat ideas for the higher-level components as well, but I’ll save those for later.

Why build a new operating system? Well, for a start, it’s really fun. But I also take most of my projects pretty seriously and aim for real-world usability, though it remains to be seen if this will be achieved. This is a hugely ambitious project, or, in other words, my favorite kind of project. Even if it’s not ultimately useful, it will drive the development of a lot of useful stuff. We’re planning to design a debugger that will be ported to Linux as well, and we’ll be developing DWARF support for Hare to facilitate this. The GUI toolkit we want to build for Ares will also be generally applicable. And Helios and Mercury together have a reasonably small scope and makes for an interesting and useful platform in their own right, even if the rest of the stack never completely materializes. If nothing else, it will probably be able to run DOOM fairly soon.

The kernel is a microkernel, so it is fairly narrow in scope and will probably be more-or-less complete in the foreseeable future. The next to-do items are context switching, so we can set up multi-tasking, IPC, fault handling, and userspace support for interrupts. We’ll also need to parse the ACPI tables and bring up PCI in the kernel before handing it off to userspace. Once these things are in place, the kernel is essentially ready to be used to write most drivers, and the focus will move to fleshing out Mercury and Venus, followed by a small version of Gaia that can at least support an interactive shell. There are some longer-term features which will be nice to have in the kernel at some point, though, such as SMP, IOMMU, or VT-x support.

Feel free to pull down the code and check it out, though remember my warning that it doesn’t do too much yet. You can download the latest ISO from the CI, if you want to reproduce the picture at the top of this post, and write it to a flash drive to stick in the x86_64 computer of your choice (boot via legacy BIOS). If you want to mess with the code, you could play around with the Vulcan system to get simple programs running in userspace. The kernel serial driver is write-only, but a serial driver written in userspace could easily be made to support interactive programs. If you’re feeling extra adventureous, it probably wouldn’t be too difficult to get a framebuffer online and draw some pixels — ping me in #helios on Libera Chat for a few words of guidance if you want to try it.

Articles from blogs I read Generated by openring

I created a monster

I guess it’s not a surprise, but I just don’t enjoy writing very much. I do, however, recognize its importance, so I always want to try. And sometimes, there is just this weird set of circumstances that kicks everything back into motion. _Djot One feeling that…

via blogfehler! April 5, 2024

Summary of changes for March 2024

Hey everyone!This is the list of all the changes we've done to our projects during the month of March. Summary Of Changes 100r.co, added chainplates, knots, washing dishes, receiving mail, updated our notes on diy carbonation system, and refrigeration…

via Hundred Rabbits April 1, 2024

Anatomy of a credit card rewards program

Credit card rewards are mostly funded out of interchange, a fee paid by businesses to accept cards.

via Bits about Money March 29, 2024