Lines Matching defs:cte

28 mdb_set_cte_relations(struct cte *cte, uint8_t relations, uint8_t mask)
31 cte->mdbnode.remote_copies = (relations & RRELS_COPY_BIT) != 0;
34 cte->mdbnode.remote_ancs = (relations & RRELS_ANCS_BIT) != 0;
37 cte->mdbnode.remote_descs = (relations & RRELS_DESC_BIT) != 0;
41 void mdb_set_relations(struct cte *cte, uint8_t relations, uint8_t mask)
43 assert(cte != NULL);
45 bool old_copies = cte->mdbnode.remote_copies;
46 bool old_ancs = cte->mdbnode.remote_ancs;
47 bool old_descs = cte->mdbnode.remote_descs;
49 mdb_set_cte_relations(cte, relations, mask);
51 if (cte->mdbnode.remote_copies == old_copies
52 && cte->mdbnode.remote_ancs == old_ancs
53 && cte->mdbnode.remote_descs == old_descs)
60 for (struct cte *next = mdb_successor(cte);
61 next && is_copy(&next->cap, &cte->cap);
70 cte, old_copies, old_ancs, old_descs,
78 for (struct cte *prev = mdb_predecessor(cte);
79 prev && is_copy(&prev->cap, &cte->cap);
88 cte, old_copies, old_ancs, old_descs,
97 /// Check if #cte has any descendants
99 bool has_descendants(struct cte *cte)
102 assert(cte != NULL);
104 struct cte *next = mdb_find_greater(&cte->cap, false);
106 && get_type_root(next->cap.type) == get_type_root(cte->cap.type)
107 && get_address(&next->cap) < get_address(&cte->cap) + get_size(&cte->cap);
110 bool has_ancestors(struct cte *cte) {
111 return mdb_find_ancestor(cte) != NULL;
115 struct cte *mdb_find_ancestor(struct cte *cte)
117 assert(cte != NULL);
118 struct cte *result = NULL;
123 if (!get_address(&cte->cap) && !get_size(&cte->cap)) {
128 result = mdb_find_less(&cte->cap, false);
130 && get_type_root(result->cap.type) == get_type_root(cte->cap.type)
132 >= get_address(&cte->cap) + get_size(&cte->cap))
137 // cte is preceded in the ordering by a non-ancestor. This imples one of
139 // 1) cte has no ancestors
140 // 2) cte has ancestors but also has siblings earlier in the
142 // address as cte.
143 // If we query for the zero-length memory region at cte's start
144 // address, we will not get cte itself back as the end of our query
145 // is at cte's start address.
146 // Similarly, we cannot get a sibling of cte that ends where cte
152 mdb_find_range(get_type_root(cte->cap.type),
153 get_address(&cte->cap), 0,
159 assert(get_address(&result->cap) <= get_address(&cte->cap));
161 >= get_address(&cte->cap) + get_size(&cte->cap));
173 /// Checks if #cte has any copies
174 bool has_copies(struct cte *cte)
177 assert(cte != NULL);
179 struct cte *next = mdb_successor(cte);
182 if (next && is_copy(&next->cap, &cte->cap)) {
186 struct cte *prev = mdb_predecessor(cte);
189 if (prev && is_copy(&prev->cap, &cte->cap)) {
204 struct cte *cte = mdb_find_equal(cap);
205 if (cte) {
206 *ret = &cte->cap;
234 void set_init_mapping(struct cte *dest_start, size_t num)
242 void remove_mapping(struct cte *cte)
244 mdb_remove(cte);