+ /*
+ * Allocate a master-local dataspace object.
+ */
+ static void
+ allocate_ds(L4::Cap<L4Re::Dataspace> *cap, unsigned size)
+ {
+ *cap = L4Re::Util::cap_alloc.alloc<L4Re::Dataspace>();
+ _check(!cap->is_valid(), "error allocating DS capability");
+
+ int error = L4Re::Env::env()->mem_alloc()->alloc(size, *cap);
+ _check(error != 0, "error allocating memory");
+ }
+
+
+ /*
+ * Allocate and attach a master-local dataspace object.
+ */
+ static l4_addr_t
+ allocate_and_attach(L4::Cap<L4Re::Dataspace> *cap, unsigned size,
+ unsigned offs = 0, unsigned align = L4_PAGESHIFT)
+ {
+ Romain::Region_map::allocate_ds(cap, size);
+
+ l4_addr_t a = 0;
+ int error = L4Re::Env::env()->rm()->attach(&a, size, L4Re::Rm::Search_addr, *cap, offs, align);
+ _check(error != 0, "attach failed");
+
+ return a;
+ }
+
+