sel4_microkit

Attribute Macro protection_domain

#[protection_domain]
Expand description

Declares a function to be the the protection domain’s initialization function.

For example:

#[protection_domain]
fn init() -> impl Handler {
    todo!()
}

The initialization function have a signature of the form:

fn<T: Handler>() -> T

(See Handler)

This macro takes two optional parameters, whose values can be any expression of type usize:

#[protection_domain(
    stack_size = <stack_size_expr: usize>,
    heap_size = <heap_size_expr: usize>,
)]
  • stack_size: Declares the size of the protection domain’s stack, in bytes. Note that this includes space for thread-local storage. If absent, DEFAULT_STACK_SIZE will be used.
  • heap_size: Creates a #[global_allocator], backed by a static heap of the specified size. If this parameter is not specified, no #[global_allocator] will be automatically declared, and, unless one is manually declared, heap allocations will result in a link-time error.

Note that, if both parameters are provided, they must appear in the order above.