Hello, World!

Navigate to and run the hello world Microkit example:

cd workspaces/microkit/hello-world
make simulate

Here is its source:

The sel4_microkit crate implements a Rust language runtime for Microkit protection domains, and implements the Microkit API. It is written in pure Rust, and does not link against libmicrokit.

The Event Handler

The #[protection_domain] attribute macro declares a function to be the protection domain's initialization function. The entrypoint function must have a signature of the form:

fn() -> T
where
    T: sel4_microkit::Handler

An implementation of the Handler trait is used by the runtime as the event handler for the protection domain's main loop. The notified, protected, and fault methods correspond to their equivalents in <microkit.h>.

The default implementations of these methods just panic. Our event handler, which we've called HandlerImpl, is the simplest possible Handler implementation.

Language Runtime

As detailed in its rustdoc, the #[protection_domain] attribute macro takes the same parameters as #[root_task]. Furthermore, the sel4_microkit crate supports all of the same Rust language runtime elements that we explored in Chapter 2, including sel4_microkit::panicking::catch_unwind() and sel4_microkit::panicking::set_hook() .