Handling Exceptions using naked Functions
These posts explain how to handle CPU exceptions using naked functions. Historically, these posts were the main exception handling posts before the
x86-interrupt calling convention and the
x86_64 crate existed. Our new way of handling exceptions can be found in the “Handling Exceptions” post.
In this post, we start exploring exceptions. We set up an interrupt descriptor table and add handler functions. At the end of this post, our kernel will be able to catch divide-by-zero faults.read more »
Better Exception Messages
In this post, we explore exceptions in more detail. Our goal is to print additional information when an exception occurs, for example the values of the instruction and stack pointer. In the course of this, we will explore inline assembly and naked functions. We will also add a handler function for page faults and read the associated error code.read more »
Returning from Exceptions
In this post, we learn how to return from exceptions correctly. In the course of this, we will explore the
iretq instruction, the C calling convention, multimedia registers, and the red zone.