diff --git a/repos/base-foc/src/lib/base/thread_start.cc b/repos/base-foc/src/lib/base/thread_start.cc
index d4a1fc48b..8ab328509 100644
--- a/repos/base-foc/src/lib/base/thread_start.cc
+++ b/repos/base-foc/src/lib/base/thread_start.cc
@@ -49,13 +49,14 @@ void Thread::_init_platform_thread(size_t weight, Type type)
{
/* if no cpu session is given, use it from the environment */
if (!_cpu_session)
- _cpu_session = env()->cpu_session();
+ _cpu_session = env_deprecated()->cpu_session();
if (type == NORMAL)
{
/* create thread at core */
- _thread_cap = _cpu_session->create_thread(env()->pd_session_cap(), name(),
- Location(), Weight(weight));
+ _thread_cap = _cpu_session->create_thread(env_deprecated()->pd_session_cap(),
+ name(), Location(),
+ Weight(weight));
/* assign thread to protection domain */
if (!_thread_cap.valid())
@@ -65,7 +66,7 @@ void Thread::_init_platform_thread(size_t weight, Type type)
}
/* adjust values whose computation differs for a main thread */
native_thread().kcap = Fiasco::MAIN_THREAD_CAP;
- _thread_cap = env()->parent()->main_thread_cap();
+ _thread_cap = env_deprecated()->parent()->main_thread_cap();
if (!_thread_cap.valid())
throw Cpu_session::Thread_creation_failed();
diff --git a/repos/base-foc/src/test/cap_integrity/main.cc b/repos/base-foc/src/test/cap_integrity/main.cc
index d7de8b821..06eed4426 100644
--- a/repos/base-foc/src/test/cap_integrity/main.cc
+++ b/repos/base-foc/src/test/cap_integrity/main.cc
@@ -14,8 +14,7 @@
*/
/* Genode includes */
-#include
-#include
+#include
#include
#include
@@ -25,14 +24,18 @@
using namespace Genode;
using namespace Fiasco;
-int main(int argc, char **argv)
+
+struct Main { Main(Env &env); };
+
+
+Main::Main(Env &env)
{
log("--- capability integrity test ---");
enum { COUNT = 1000 };
Cap_index* idx = cap_idx_alloc()->alloc_range(COUNT);
- Fiasco::l4_cap_idx_t tid = Capability_space::kcap(env()->ram_session_cap());
+ Fiasco::l4_cap_idx_t tid = Capability_space::kcap(env.ram_session_cap());
/* try the first 1000 local name IDs */
for (int local_name = 0; local_name < COUNT; local_name++, idx++) {
@@ -50,5 +53,8 @@ int main(int argc, char **argv)
}
log("--- finished capability integrity test ---");
- return 0;
+ env.parent().exit(0);
}
+
+
+void Component::construct(Env &env) { static Main main(env); }
diff --git a/repos/base-linux/src/test/lx_rmap/main.cc b/repos/base-linux/src/test/lx_rmap/main.cc
index 912f123e8..6e16d25ca 100644
--- a/repos/base-linux/src/test/lx_rmap/main.cc
+++ b/repos/base-linux/src/test/lx_rmap/main.cc
@@ -12,14 +12,14 @@
*/
/* Genode includes */
-#include
-#include
-#include
+#include
+#include
#include
#include
#include
#include
+using namespace Genode;
static void blob() __attribute__((used));
static void blob()
@@ -34,22 +34,26 @@ static void blob()
: : : );
}
-
extern unsigned long blob_beg;
extern unsigned long blob_end;
-
-int main()
+struct Main
{
- using namespace Genode;
+ Heap heap;
+ Main(Env &env);
+};
+
+Main::Main(Env &env) : heap(env.ram(), env.rm())
+{
/* activate for early printf in Rm_session_mmap::attach() etc. */
if (0) Thread::trace("FOO");
/* induce initial heap expansion to remove RM noise */
if (1) {
- void *addr(env()->heap()->alloc(0x100000));
- env()->heap()->free(addr, 0);
+ void *addr;
+ heap.alloc(0x100000, &addr);
+ heap.free(addr, 0);
}
addr_t beg((addr_t)&blob_beg);
@@ -61,47 +65,50 @@ int main()
/* RAM dataspace attachment overlapping binary */
try {
- Ram_dataspace_capability ds(env()->ram_session()->alloc(size));
+ Ram_dataspace_capability ds(env.ram().alloc(size));
log("before RAM dataspace attach");
- env()->rm_session()->attach_at(ds, beg);
+ env.rm().attach_at(ds, beg);
error("after RAM dataspace attach -- ERROR");
- sleep_forever();
+ env.parent().exit(-1);
} catch (Region_map::Region_conflict) {
log("OK caught Region_conflict exception");
}
/* empty managed dataspace overlapping binary */
try {
- Rm_connection rm_connection;
+ Rm_connection rm_connection(env);
Region_map_client rm(rm_connection.create(size));
Dataspace_capability ds(rm.dataspace());
log("before sub-RM dataspace attach");
- env()->rm_session()->attach_at(ds, beg);
+ env.rm().attach_at(ds, beg);
error("after sub-RM dataspace attach -- ERROR");
- sleep_forever();
+ env.parent().exit(-1);
} catch (Region_map::Region_conflict) {
log("OK caught Region_conflict exception");
}
/* sparsely populated managed dataspace in free VM area */
try {
- Rm_connection rm_connection;
+ Rm_connection rm_connection(env);
Region_map_client rm(rm_connection.create(0x100000));
- rm.attach_at(env()->ram_session()->alloc(0x1000), 0x1000);
+ rm.attach_at(env.ram().alloc(0x1000), 0x1000);
Dataspace_capability ds(rm.dataspace());
log("before populated sub-RM dataspace attach");
- char *addr = (char *)env()->rm_session()->attach(ds) + 0x1000;
+ char *addr = (char *)env.rm().attach(ds) + 0x1000;
log("after populated sub-RM dataspace attach / before touch");
char const val = *addr;
*addr = 0x55;
log("after touch (", val, "/", *addr, ")");
} catch (Region_map::Region_conflict) {
error("Caught Region_conflict exception -- ERROR");
- sleep_forever();
+ env.parent().exit(-1);
}
+ env.parent().exit(0);
}
+
+void Component::construct(Env &env) { static Main main(env); }
diff --git a/repos/base-linux/src/test/region_map_mmap/main.cc b/repos/base-linux/src/test/region_map_mmap/main.cc
index aa96dcc94..077d0bc71 100644
--- a/repos/base-linux/src/test/region_map_mmap/main.cc
+++ b/repos/base-linux/src/test/region_map_mmap/main.cc
@@ -11,25 +11,23 @@
* under the terms of the GNU Affero General Public License version 3.
*/
-#include
-#include
+#include
#include
#include
+using namespace Genode;
-static void test_linux_rmmap_bug()
+static void test_linux_rmmap_bug(Env &env)
{
enum { QUOTA = 1*1024*1024, CHUNK = 0x1000, ROUNDS = 0x10 };
- using namespace Genode;
-
log("line: ", __LINE__);
- Ram_connection ram;
+ Ram_connection ram(env);
#if 1 /* transfer quota */
log("line: ", __LINE__);
- ram.ref_account(env()->ram_session_cap());
- env()->ram_session()->transfer_quota(ram.cap(), QUOTA);
+ ram.ref_account(env.ram_session_cap());
+ env.ram().transfer_quota(ram.cap(), QUOTA);
#endif
log("line: ", __LINE__);
@@ -41,10 +39,14 @@ static void test_linux_rmmap_bug()
log("Done.");
}
+struct Main { Main(Env &env); };
-int main()
+Main::Main(Env &env)
{
Genode::log("--- test-rm_session_mmap started ---");
- test_linux_rmmap_bug();
+ test_linux_rmmap_bug(env);
}
+
+
+void Component::construct(Env &env) { static Main main(env); }
diff --git a/repos/base/include/trace_session/connection.h b/repos/base/include/trace_session/connection.h
index 3b30a8f4f..98d164b98 100644
--- a/repos/base/include/trace_session/connection.h
+++ b/repos/base/include/trace_session/connection.h
@@ -61,9 +61,10 @@ struct Genode::Trace::Connection : Genode::Connection,
*/
Connection(size_t ram_quota, size_t arg_buffer_size, unsigned parent_levels) __attribute__((deprecated))
:
- Genode::Connection(_session(*env()->parent(), ram_quota,
- arg_buffer_size, parent_levels)),
- Session_client(*env()->rm_session(), cap())
+ Genode::Connection(_session(*env_deprecated()->parent(),
+ ram_quota, arg_buffer_size,
+ parent_levels)),
+ Session_client(*env_deprecated()->rm_session(), cap())
{ }
};