Attribute Macro sel4_microkit::protection_domain

#[protection_domain]
Expand description

Declares the initialization function, stack size, and, optionally, heap and heap size.

The syntax is:

#[protection_domain($($key:ident = $value:expr),* $(,)?)]
fn init() -> impl Handler {
   // ...
}

Where the possible keys are:

  • stack_size: Sets the stack size. Defaults to 0x4000.
  • heap_size: Declares a #[global_allocator] implemented using Dlmalloc and a statically-allocated heap. Optional.

The function to which the attribute is applied will be used to initialize the protection domain. It must satisfy FnOnce() -> T where T: Handler.

This macro is a thin wrapper around sel4_microkit::declare_protection_domain. The following are equivalent:

#[protection_domain(stack_size = 0x12000, heap_size = 0x34000)]
fn init() -> impl Handler {
    // ...
}
declare_protection_domain! {
    init = my_init,
    stack_size = 0x12000,
    heap_size = 0x34000,
}

fn init() -> impl Handler {
    // ...
}