Merge branch 'master' of git.mousetrap.xyz:alex/genode-Tests

This commit is contained in:
2019-03-27 12:36:22 +01:00
2 changed files with 32 additions and 16 deletions

View File

@@ -70,24 +70,40 @@ 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)
{
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) {
}
/* The component does not exit after the construct function returns. Instead, it be-
* comes ready to respond to requests or signals originating from other components. The
* example above does not interact with other components though.
*
* Genode Foundations p. 30
*/
}

View File

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