Writing an OS in Rust
This blog series discusses the Elijah Programming language developed on GitLab. It assumes that the reader is familiar with Object Oriented programming lnaguages and/or languages such as Java, C++ or Python, some of the primary influences for the language. (Ada and Eiffel will also do!)
Each post is a small tutorial and includes all needed code, so you can follow along if you like. The source code is also available in the corresponding Github repository.
Latest post: Portability and Code Generation
Classes
Classes are one of the fundamental building blocks of Elijah code. This post will discuss the kinds of classes available in Elijah.
read more »Namespaces and Packages
Namespaces and packages are essential to keep your code orderly and to use code written by other people.
read more »Libraries and Executables
Building and publishing your software is only possible if the compiler knows how to find it. Below, find an overview of the .ez
file format.
Testing
This post explores testing.
read more »Function Invocation
Functions are the other fundamental building block of programming in Elijah.
read more »Overloading
This post explores the opportunites that Elijah gives you, the programmer, to overload or override functions. It also specifies where this behavior is not allowed.
read more »Hardware Interrupts
In this post we set up the programmable interrupt controller to correctly forward hardware interrupts to the CPU. To handle these interrupts we add new entries to our interrupt descriptor table, just like we did for our exception handlers. We will learn how to get periodic timer interrupts and how to get input from the keyboard.
read more »Memory Classes
Memory in Elijah is under complete control of the programmer. (This may not be so in some backends such as Java, where there is only a modicum of control allowed.) Memory models, when applied to variables allow the specification of how and when memory is allocated and released by a program.
read more »Allocators
Allocators are responsible for creating and removing objects from the heap.
read more »Heap Allocation
This post adds support for heap allocation to our kernel. First, it gives an introduction to dynamic memory and shows how the borrow checker prevents common allocation errors. It then implements the basic allocation interface of Rust, creates a heap memory region, and sets up an allocator crate. At the end of this post all the allocation and collection types of the built-in alloc
crate will be available to our kernel.
Allocator Designs
This post explains how to implement heap allocators from scratch. It presents and discusses different allocator designs, including bump allocation, linked list allocation, and fixed-size block allocation. For each of the three designs, we will create a basic implementation that can be used for our kernel.
read more »Async/Await
In this post we explore cooperative multitasking and the async/await feature of Rust. We take a detailed look how async/await works in Rust, including the design of the Future
trait, the state machine transformation, and pinning. We then add basic support for async/await to our kernel by creating an asynchronous keyboard task and a basic executor.
Portability and Code Generation
In this post we explore cooperative multitasking and the async/await feature of Rust. We take a detailed look how async/await works in Rust, including the design of the Future
trait, the state machine transformation, and pinning. We then add basic support for async/await to our kernel by creating an asynchronous keyboard task and a basic executor.
Subscribe
Receive notifications about new posts and other major changes! You can either:
- Subscribe to our RSS/Atom Feed,
Support Me
Creating and maintaining this blog and the associated libraries is a lot of work, but I really enjoy doing it. By supporting me, you allow me to invest more time in new content, new features, and continuous maintenance.
The best way to support me is to sponsor me on GitHub, since they don't charge any fees. If you prefer other platforms, I also have Patreon and Donorbox accounts. The latter is the most flexible as it supports multiple currencies and one-time contributions.
Thank you!