mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-30 18:47:01 +00:00
2b161b7aff
Kernel patch: Introduce a transfer item type to express that a cap should be translated and if this fails to map it instead. It would be possible without this combined transfer item type however with additional overhead. In this case Genode/NOVA would have to map and translate all caps used as parameter in IPC. It would look like this: * If the map and translation succeed, the cap at the new cap index would have to be revoked. Then the translated cap index can be used. * If the map succeeds and the translation fails then the mapped cap index can be used. * It would become complicated when multiple caps are mapped and translated and only some of the translation succeed. In such cases Genode would have to figure out the right relation of translated/mapped and not translated/mapped caps. It would require to make some assumption about the order how translated/mapped caps are reported at the UTCB by the kernel. All the points above lead to the decision to create a separate transfer item type for that. Genode: Most the times the translation succeeds, mapping of caps happens either seldom. This takes now a bit the pressure of not enough aligned receive cap windows as described in issue #247. The patch mainly adds adjustments to handle the translated and mapped caps correctly especially during freeing of the receive window (don't free translated cap indexes). Fixes #268
52 lines
1.5 KiB
Diff
52 lines
1.5 KiB
Diff
diff --git a/src/pd.cpp b/src/pd.cpp
|
|
index 8160d73..be9aa63 100644
|
|
--- a/src/pd.cpp
|
|
+++ b/src/pd.cpp
|
|
@@ -173,8 +173,9 @@ void Pd::xlt_crd (Pd *pd, Crd xlt, Crd &crd)
|
|
sb = (sb - mdb->node_base) + (mdb->node_phys - node->node_phys) + node->node_base;
|
|
|
|
if ((ro = clamp (sb, rb, so, ro)) != ~0UL) {
|
|
+ trace (TRACE_DEL, "XLT OBJ PD:%p->%p SB:%#010lx RB:%#010lx O:%#04lx", pd, this, crd.base(), rb, so);
|
|
crd = Crd (crd.type(), rb, ro, mdb->node_attr);
|
|
- return;
|
|
+ return;
|
|
}
|
|
}
|
|
}
|
|
@@ -245,22 +246,32 @@ void Pd::rev_crd (Crd crd, bool self)
|
|
|
|
void Pd::xfer_items (Pd *src, Crd xlt, Crd del, Xfer *s, Xfer *d, unsigned long ti)
|
|
{
|
|
- for (Crd crd; ti--; s--) {
|
|
+ mword set_as_del;
|
|
|
|
+ for (Crd crd; ti--; s--) {
|
|
+
|
|
crd = *s;
|
|
+ set_as_del = 0;
|
|
|
|
- switch (s->flags() & 1) {
|
|
+ switch (s->flags() & 3) {
|
|
|
|
case 0:
|
|
xlt_crd (src, xlt, crd);
|
|
break;
|
|
|
|
+ case 2:
|
|
+ xlt_crd (src, xlt, crd);
|
|
+ if (crd.type()) break;
|
|
+
|
|
+ crd = *s;
|
|
+ set_as_del = 1;
|
|
+
|
|
case 1:
|
|
del_crd (src == &root && s->flags() & 0x800 ? &kern : src, del, crd, s->flags() >> 9 & 3, s->hotspot());
|
|
break;
|
|
};
|
|
|
|
if (d)
|
|
- *d-- = Xfer (crd, s->flags());
|
|
+ *d-- = Xfer (crd, s->flags() | set_as_del);
|
|
}
|
|
}
|