1.1 --- a/libexec/lib/src/external_pager.cc Mon Mar 06 16:04:23 2023 +0100
1.2 +++ b/libexec/lib/src/external_pager.cc Mon Mar 06 16:05:44 2023 +0100
1.3 @@ -24,6 +24,7 @@
1.4 #include <l4/util/util.h>
1.5
1.6 #include <ipc/cap_alloc.h>
1.7 +#include <ipc/map.h>
1.8 #include <ipc/mem_ipc.h>
1.9 #include <mem/memory_utils.h>
1.10 #include <systypes/base.h>
1.11 @@ -68,12 +69,14 @@
1.12 MappedRegion &r = it->second;
1.13
1.14 ipc_detach_dataspace((void *) r.ds_start);
1.15 - printf("Free %lx\n", r.ds);
1.16 ipc_cap_free_um(r.ds);
1.17 }
1.18
1.19 + /* Remove the created task. */
1.20 +
1.21 if (l4_is_valid_cap(_task))
1.22 {
1.23 + ipc_unmap_capability(_task, _rtask);
1.24 ipc_cap_free_um(_task);
1.25 _task = L4_INVALID_CAP;
1.26 }
1.27 @@ -106,9 +109,10 @@
1.28 _rparent = rcap;
1.29 }
1.30
1.31 -void ExternalPager::set_task(l4_cap_idx_t cap)
1.32 +void ExternalPager::set_task(l4_cap_idx_t cap, l4_cap_idx_t rcap)
1.33 {
1.34 _task = cap;
1.35 + _rtask = rcap;
1.36 }
1.37
1.38
1.39 @@ -253,7 +257,7 @@
1.40
1.41 if (l4_is_valid_cap(_ipc_gate))
1.42 {
1.43 - l4_task_unmap(L4RE_THIS_TASK_CAP, l4_obj_fpage(_ipc_gate, 0, L4_CAP_FPAGE_RWSD), L4_FP_ALL_SPACES);
1.44 + ipc_cap_free_um(_ipc_gate);
1.45 _ipc_gate = L4_INVALID_CAP;
1.46 }
1.47
1.48 @@ -262,17 +266,10 @@
1.49
1.50 else if (l4_is_valid_cap(_task))
1.51 {
1.52 - /* NOTE: Capability indexes to be obtained from the process creation
1.53 - activity. */
1.54 -
1.55 - /* Log. */
1.56 -
1.57 - l4_task_unmap(_task, l4_obj_fpage(0x05UL << L4_CAP_SHIFT, 0, L4_CAP_FPAGE_RWSD), L4_FP_ALL_SPACES);
1.58 -
1.59 /* Parent and pager/region mapper. */
1.60
1.61 - l4_task_unmap(_task, l4_obj_fpage(_rparent, 0, L4_CAP_FPAGE_RWSD), L4_FP_ALL_SPACES);
1.62 - l4_task_unmap(_task, l4_obj_fpage(_rpager, 0, L4_CAP_FPAGE_RWSD), L4_FP_ALL_SPACES);
1.63 + ipc_unmap_capability(_task, _rparent);
1.64 + ipc_unmap_capability(_task, _rpager);
1.65
1.66 /* Threads. For some reason, these cannot be released by the process, so
1.67 they are also unmapped on its behalf. */
1.68 @@ -283,7 +280,7 @@
1.69 ipc_cap_free_um(*it);
1.70
1.71 for (it = _rthreads.begin(); it != _rthreads.end(); it++)
1.72 - l4_task_unmap(_task, l4_obj_fpage(*it, 0, L4_CAP_FPAGE_RWSD), L4_FP_ALL_SPACES);
1.73 + ipc_unmap_capability(_task, *it);
1.74 }
1.75 }
1.76