Make minimal child example functional

This commit is contained in:
2019-02-28 18:06:30 +01:00
parent dfea92c1cf
commit b9b469c9a2
2 changed files with 26 additions and 17 deletions

View File

@@ -70,24 +70,33 @@ public:
} }
}; };
namespace Example {
struct Main;
}
struct Example::Main
{
Genode::Env &_env;
Genode::Heap _heap { _env.ram(), _env.rm() };
MyChild::Parent_services _parent_services { };
Main(Genode::Env &env) : _env(env)
{
const char *names[] = { "RM", "PD", "CPU", "IO_MEM", "IO_PORT", "IRQ", "ROM", "LOG", 0 };
for (unsigned i = 0; names[i]; i++) {
new (_heap) MyChild::Parent_service(_parent_services, env, names[i]);
}
new (_heap) MyChild(_env, _parent_services);
}
};
void Component::construct(Genode::Env &env) void Component::construct(Genode::Env &env)
{ {
Genode::log("Hello World from child!"); Genode::log("Hello World from child!");
Genode::Heap _heap {env.ram(), env.rm()}; static Example::Main main(env);
static const char *names[] = {
/* core services */
"RM", "PD", "CPU", "IO_MEM", "IO_PORT", "IRQ", "ROM", "LOG",
0 /* null-termination */
};
MyChild::Parent_services _parent_services { };
for (unsigned i = 0; names[i]; i++)
new (_heap) MyChild::Parent_service(_parent_services, env, names[i]);
MyChild mychild(env, _parent_services);
while(1) {
}
} }

View File

@@ -1,6 +1,6 @@
#include <base/component.h> #include <base/component.h>
void Component::construct(Genode::Env &env) void Component::construct(Genode::Env &)
{ {
Genode::log("Hello World from hello!"); Genode::log("Hello World from hello!");
} }