|
17 | 17 | permitLoad, \
|
18 | 18 | permitStore, \
|
19 | 19 | permitLoadStoreCapabilities, \
|
20 |
| - permitLoadMutable) \ |
| 20 | + permitLoadMutable, \ |
| 21 | + permitLoadGlobal) \ |
21 | 22 | ({ \
|
22 | 23 | type *ret; /* NOLINT(bugprone-macro-parentheses) */ \
|
23 | 24 | __asm(".ifndef " mangledName "\n" \
|
|
39 | 40 | : "i"(((permitLoad) ? (1 << 31) : 0) + \
|
40 | 41 | ((permitStore) ? (1 << 30) : 0) + \
|
41 | 42 | ((permitLoadStoreCapabilities) ? (1 << 29) : 0) + \
|
42 |
| - ((permitLoadMutable) ? (1 << 28) : 0))); \ |
| 43 | + ((permitLoadMutable) ? (1 << 28) : 0) + \ |
| 44 | + ((permitLoadGlobal) ? (1 << 27) : 0))); \ |
43 | 45 | ret; \
|
44 | 46 | })
|
45 | 47 |
|
|
52 | 54 | permitLoad, \
|
53 | 55 | permitStore, \
|
54 | 56 | permitLoadStoreCapabilities, \
|
55 |
| - permitLoadMutable) \ |
| 57 | + permitLoadMutable, \ |
| 58 | + permitLoadGlobal) \ |
56 | 59 | IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER(type, \
|
57 | 60 | name, \
|
58 | 61 | __export_mem_, \
|
59 | 62 | mangledName, \
|
60 | 63 | permitLoad, \
|
61 | 64 | permitStore, \
|
62 | 65 | permitLoadStoreCapabilities, \
|
63 |
| - permitLoadMutable) |
| 66 | + permitLoadMutable, \ |
| 67 | + permitLoadGlobal) |
64 | 68 |
|
65 | 69 | /**
|
66 | 70 | * Provide a capability of the type `volatile type *` referring to the MMIO
|
|
76 | 80 | permitLoad, \
|
77 | 81 | permitStore, \
|
78 | 82 | permitLoadStoreCapabilities, \
|
79 |
| - permitLoadMutable) \ |
| 83 | + permitLoadMutable, \ |
| 84 | + permitLoadGlobal) \ |
80 | 85 | MMIO_CAPABILITY_WITH_PERMISSIONS_HELPER( \
|
81 | 86 | volatile type, /* NOLINT(bugprone-macro-parentheses) */ \
|
82 | 87 | name, \
|
83 | 88 | "__import_mem_" #name "_" #permitLoad "_" #permitStore \
|
84 |
| - "_" #permitLoadStoreCapabilities "_" #permitLoadMutable, \ |
| 89 | + "_" #permitLoadStoreCapabilities "_" #permitLoadMutable \ |
| 90 | + "_" #permitLoadGlobal, \ |
85 | 91 | permitLoad, \
|
86 | 92 | permitStore, \
|
87 | 93 | permitLoadStoreCapabilities, \
|
88 |
| - permitLoadMutable) |
| 94 | + permitLoadMutable, \ |
| 95 | + permitLoadGlobal) |
89 | 96 |
|
90 | 97 | /**
|
91 | 98 | * Provide a capability of the type `volatile type *` referring to the MMIO
|
|
97 | 104 | * MMIO_CAPABILITY_WITH_PERMISSIONS.
|
98 | 105 | */
|
99 | 106 | #define MMIO_CAPABILITY(type, name) \
|
100 |
| - MMIO_CAPABILITY_WITH_PERMISSIONS(type, name, true, true, false, false) |
| 107 | + MMIO_CAPABILITY_WITH_PERMISSIONS( \ |
| 108 | + type, name, true, true, false, false, false) |
101 | 109 |
|
102 | 110 | /**
|
103 | 111 | * Provide a capability of the type `type *` referring to the pre-shared object
|
|
113 | 121 | permitLoad, \
|
114 | 122 | permitStore, \
|
115 | 123 | permitLoadStoreCapabilities, \
|
116 |
| - permitLoadMutable) \ |
| 124 | + permitLoadMutable, \ |
| 125 | + permitLoadGlobal) \ |
117 | 126 | IMPORT_CAPABILITY_WITH_PERMISSIONS_HELPER( \
|
118 | 127 | type, /* NOLINT(bugprone-macro-parentheses) */ \
|
119 | 128 | name, \
|
120 | 129 | __cheriot_shared_object_, \
|
121 | 130 | "__import_cheriot_shared_object_" #name "_" #permitLoad "_" #permitStore \
|
122 |
| - "_" #permitLoadStoreCapabilities "_" #permitLoadMutable, \ |
| 131 | + "_" #permitLoadStoreCapabilities "_" #permitLoadMutable \ |
| 132 | + "_" #permitLoadGlobal, \ |
123 | 133 | permitLoad, \
|
124 | 134 | permitStore, \
|
125 | 135 | permitLoadStoreCapabilities, \
|
126 |
| - permitLoadMutable) |
| 136 | + permitLoadMutable, \ |
| 137 | + permitLoadGlobal) |
127 | 138 |
|
128 | 139 | /**
|
129 | 140 | * Provide a capability of the type `type *` referring to the pre-shared object
|
130 | 141 | * with `name` as its name. This macro can be used only in code (it cannot be
|
131 | 142 | * used to initialise a global).
|
132 | 143 | *
|
133 | 144 | * Pre-shared object capabilities produced by this macro have load, store,
|
134 |
| - * load-mutable, and load/store-capability permissions. To define a reduced |
135 |
| - * set of permissions use `SHARED_OBJECT_WITH_PERMISSIONS`. |
| 145 | + * load-mutable, load-global, and load/store-capability permissions. To define |
| 146 | + * a reduced set of permissions use `SHARED_OBJECT_WITH_PERMISSIONS`. |
136 | 147 | */
|
137 | 148 | #define SHARED_OBJECT(type, name) \
|
138 |
| - SHARED_OBJECT_WITH_PERMISSIONS(type, name, true, true, true, true) |
| 149 | + SHARED_OBJECT_WITH_PERMISSIONS(type, name, true, true, true, true, true) |
| 150 | + |
| 151 | +/** |
| 152 | + * Provide a capability of the type `type *` referring to the pre-shared object |
| 153 | + * with `name` as its name. This macro can be used only in code (it cannot be |
| 154 | + * used to initialise a global). |
| 155 | + * |
| 156 | + * Pre-shared object capabilities produced by this macro have the indicated load |
| 157 | + * and store permission, but no load/store-capability permissions (and, |
| 158 | + * therefore, no load-mutable or load-global permissions). |
| 159 | + */ |
| 160 | +#define SHARED_OBJECT_WITH_DATA_PERMISSIONS( \ |
| 161 | + type, name, permitLoad, permitStore) \ |
| 162 | + SHARED_OBJECT_WITH_PERMISSIONS( \ |
| 163 | + type, name, permitLoad, permitStore, false, false, false) |
139 | 164 |
|
140 | 165 | /**
|
141 | 166 | * Macro to test whether a device with a specific name exists in the board
|
|
0 commit comments