This library provides a simple, architecture independent way to detect the current privilege level (CPL).
Example
use ;
#
Details
The main entrypoint into this crate is through the [privilege_level] function.
That will use the architecture dependent code necessary to determine the current privilege level then converts it into the common API.
The common API ([PrivilegeLevel]) is meant to be usable on any platform.
It contains generic privilege levels that are common on most architectures.
However, it's not always possible to include support for every architecture.
As a compromise, depending on the target architecture, certain functions will be made available that return architecture-specific structures.
If you only want the raw privilege level number rather than a symbolic structure, you can also use the [raw_privilege_level] function.
It uses architecture specific code to read the privilege level, converts it into a u16, then returns it.
It's important to note that it doesn't do anything to make the output common in any way!