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. This blog is openly developed on GitHub. If you have any problems or quest...| Writing an OS in Rust
This post introduces paging, a very common memory management scheme that we will also use for our operating system. It explains why memory isolation is needed, how segmentation works, what virtual memory is, and how paging solves memory fragmentation issues. It also explores the layout of multilevel page tables on the x86_64 architecture. This blog is openly developed on GitHub. If you have any problems or questions, please open an issue there. You can also leave comments at the bottom. The c...| Writing an OS in Rust
The VGA text mode is a simple way to print text to the screen. In this post, we create an interface that makes its usage safe and simple by encapsulating all unsafety in a separate module. We also implement support for Rust’s formatting macros. This blog is openly developed on GitHub. If you have any problems or questions, please open an issue there. You can also leave comments at the bottom. The complete source code for this post can be found in the post-03 branch. 🔗The VGA Text Buffer ...| Writing an OS in Rust
Trait for types that form a total order.| doc.rust-lang.org
RefCell<T> and the Interior Mutability Pattern| doc.rust-lang.org
Raw, unsafe pointers, `*const T`, and `*mut T`.| doc.rust-lang.org
This post explains how to implement heap allocators from scratch. It presents and discusses different allocator designs, including bump allocation, li…| os.phil-opp.com