Understanding process and interrupt contexts
In Chapter 4, Writing Your First Kernel Module – Part 1, we presented a brief section entitled Understanding kernel architecture – part 1 (if you haven’t read it yet, I suggest you do so before continuing). We will now expand on this discussion.
First off, modern processors execute code at different levels of privilege. For example, the x86-based ones offer four levels (or rings) of privilege, with Ring 0 being the most privileged and Ring 3 being the least. Similarly, the ARM-32 (AArch32) has seven execution modes, six of which are privileged. ARM64 (AArch64) uses the notion of exception levels (EL0 to EL3, with EL0 being the least and EL3 being the most privileged). Realistically though, and a key point: all modern OSs employ just two of the available CPU privilege levels – a privileged level and an unprivileged one at which code executes; we refer to them as kernel and user mode, respectively.
It&...