1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12
13#pragma once
14
15#include <sel4/sel4.h>
16#include <stdbool.h>
17#include <stdint.h>
18
19/* A named region of an address space. See usage below. */
20typedef struct {
21    uintptr_t start;
22    uintptr_t end;
23    const char *name;
24} camkes_memory_region_t;
25
26/* Print diagnostic information about a capability or virtual memory fault that
27 * has just been caught. The assumption is that this fault's information is
28 * still in your IPC buffer. This function is only expected to be called from
29 * glue code.
30 *
31 *  info - The message information from the fault message
32 *  thread_id - Numerical identifier of the faulting thread
33 *  name - Human-readable name of the faulting thread
34 *  tcb_caps_available - Whether the identifier of the thread is a usable cap
35 *  memory_map - Description of the source's address space (can be NULL)
36 *
37 * Note that if `memory_map` is provided, the final entry of the array should
38 * be a sentinel region with `start == end == 0`.
39 */
40void camkes_show_fault(seL4_MessageInfo_t info, seL4_CPtr thread_id,
41                       const char *name, bool tcb_caps_available,
42                       const camkes_memory_region_t *memory_map);
43