Entry Points
A protection domain does nothing until the platform calls it. The handlers
the platform calls are the PD’s entry points, and a proc becomes one
with a @bind annotation:
@bind(microkit.init)
proc Init() { ball! -> Skip; }
@bind(microkit.notified)
proc Notified() {
ball? -> tally -> Skip;
[io.keep_playing(rounds) != 0] ball! -> Notified()
default Skip;
}
@bind(<platform>.<entry>) is platform-neutral: the parser records the
pairs on the process and decides nothing about them. The entry points a
platform has, and what each means, belong to that platform. A process
with no @bind is internal: it runs only when a bound process references
it.
Microkit
Microkit is the platform fic targets, and it has three entry points:
| Entry | Microkit’s | Runs |
|---|---|---|
microkit.init | init() | once, when the PD boots. See Boot Initialisation. |
microkit.notified | notified(channel) | each time the kernel notifies the PD, for a channel message or an interrupt. |
microkit.protected | protected(channel, msginfo) | each time a lower-priority PD calls it on a Sync channel; the caller waits until it returns. |
init and notified are mandatory. Every protection domain binds both, and the front
end reports one that does not, naming the PD and the missing entry, before
any backend runs: fic --check, --emit=xta and --emit=c all stop.
protected is optional. A PD that receives a Sync channel without it
leaves the call to libmicrokit’s default protected(); a PD that binds it
with no Sync channel in is reported, since nothing calls it. Each entry
point binds at most one process.
A notified process that receives should be receive-headed (a warning
otherwise): it starts by consuming
the message or interrupt that woke it (see
Process Definitions). The
generated C makes each receive or interrupt await in the process a
resume point that notified() dispatches to, and init() runs the boot
process. Reaching the end of init or notified returns to the kernel;
the next notification invokes notified again.
The protected process is receive-headed on the PD’s Sync channels and
runs to completion: it starts with a choice of c? over them, and nothing
after the head receives or awaits an interrupt, since its caller waits
while it runs. protected() dispatches on the calling channel, runs to the
process’s end and returns an empty reply. See
Well-Formedness.
A microkit. name other than init, notified and protected is
accepted by the grammar and ignored.
Other platforms
A process may name several platforms on one line,
@bind(microkit.notified, cheri.interrupt_handler). fic compiles the
microkit pairs; the others are kept and not used.