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 <stdbool.h>
16#include <stddef.h>
17
18struct camkes_vma {
19
20    /* Dimensions of the region. It would seem to make more sense to give a size than an end
21     * pointer, however it is then not possible to construct the `camkes_vmas` array at
22     * compile-time.
23     */
24    void *start;
25    void *end;
26
27    /* Permissions. Note that these are the *logical* permissions the region has. It is possible
28     * that two regions overlap a single page, and thus the permissions of this page are the union
29     * of their permissions. Essentially the permissions of a VMA are the minimum permissions you
30     * can expect the memory in that region to have. 0 for all these fields means the region is
31     * deliberately unmapped memory.
32     */
33    bool read;
34    bool write;
35    bool execute;
36
37    /* Extended attributes. */
38    bool cached;
39
40    /* Friendly name of the region. This is only for debugging purposes and you should not rely on
41     * this field containing a string formatted in any particular way.
42     */
43    const char *name;
44
45};
46
47/* Address space information about the current component. Note that this is defined in generated
48 * code. Users should not assume regions will appear in any particular order.
49 */
50extern const struct camkes_vma camkes_vmas[];
51
52/* Number of members in the above array. */
53extern const size_t camkes_vmas_size;
54