diff --git a/blog/content/additional-resource/handling-exceptions-with-naked-fns.html b/blog/content/additional-resource/handling-exceptions-with-naked-fns.html new file mode 100644 index 00000000..757a067f --- /dev/null +++ b/blog/content/additional-resource/handling-exceptions-with-naked-fns.html @@ -0,0 +1,48 @@ ++++ +title = "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. +

+ +
+ +
+

+ + Catching Exceptions + +

+ +

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.

+ +
+ + +
+

+ + 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.

+ +
+ + +
+

+ + 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.

+ +
+
diff --git a/blog/content/post/09-handling-exceptions.md b/blog/content/post/09-handling-exceptions.md index b14fd357..bb871069 100644 --- a/blog/content/post/09-handling-exceptions.md +++ b/blog/content/post/09-handling-exceptions.md @@ -440,7 +440,7 @@ The documentation of the [`Idt`] struct and the [OSDev Wiki][osdev wiki exceptio ## Too much Magic? The `x86-interrupt` calling convention and the [`Idt`] type made the exception handling process relatively straightforward and painless. If this was too much magic for you and you like to learn all the gory details of exception handling, we got you covered: Our [“Handling Exceptions with Naked Functions”] series shows how to handle exceptions without the `x86-interrupt` calling convention and also creates its own `Idt` type. Historically, these posts were the main exception handling posts before the `x86-interrupt` calling convention and the `x86_64` crate existed. -[“Handling Exceptions with Naked Functions”]: {{% relref "handling-exceptions-with-naked-fns.md" %}} +[“Handling Exceptions with Naked Functions”]: {{% relref "handling-exceptions-with-naked-fns.html" %}} ## What's next? We've successfully caught our first exception and returned from it! The next step is to add handlers for other common exceptions such as page faults. We also need to make sure that we never cause a [triple fault], since it causes a complete system reset. The next post explains how we can avoid this by correctly catching [double faults].