The most obvious benefit of using rings 1 and 2 would be an architectural separation that could protect the kernel from a failed device driver. A theoretically correctly written kernel would allow a graceful crash when the driver in the outer ring had a catastrophic crash. Running the driver in ring 0 can potentially allow it to remove the entire kernel if it does not work.
The disadvantage of moving drivers to rings 1 and 2 will be the performance overhead associated with the constant need for ring transitions between the kernel and drivers. Of course, in a microkernel system this is necessary and can be fast enough depending on your needs . With proper optimization, disconnecting the kernel from its services can have very low performance. At the same time, Intel SYSENTER / SYSEXIT (and equivalent AMD SYSCALL / SYSRET ) used to quickly switch contexts allow only transitions between rings 0 and 3; A complete interrupt is required to perform context switching in or out of rings 1 or 2.
Another drawback to keep in mind is that, since many other architectures only have a supervisor and user modes (or equivalent), any platform architecture you write that controls which level elements of your code are launched will have and both:
- recorded differently depending on whether the platform has rings 1 and / or 2 and
- make another decision about what level of privilege the code has depending on the platform.
If you plan to create a system that will be built for different architectures, this can lead to some difficulties.
source share