lx_emul: support execution till condition applies

In rare cases it is necessary to execute Linux contributed code
until certain work is finished, e.g. when in a synchronous RPC call,
a session construction or destruction a result is needed. Therefore,
we introduce a new lx_emul function called lx_emul_execute_kernel_until.

Ref genodelabs/genode#4483
This commit is contained in:
Stefan Kalkowski 2022-04-25 11:17:36 +02:00 committed by Christian Helmuth
parent 8ca2c597e0
commit 4b983f92c5
2 changed files with 13 additions and 1 deletions

View File

@ -24,6 +24,8 @@ void lx_emul_register_initcall(int (*initcall)(void), const char * name);
void lx_emul_start_kernel(void * dtb);
void lx_emul_execute_kernel_until(int (*condition)(void));
void lx_emul_setup_arch(void * dtb);
int lx_emul_init_task_function(void * dtb);

View File

@ -48,7 +48,7 @@ extern "C" void lx_emul_register_initcall(int (*initcall)(void),
}
void lx_emul_start_kernel(void * dtb)
extern "C" void lx_emul_start_kernel(void * dtb)
{
using namespace Lx_kit;
@ -61,3 +61,13 @@ void lx_emul_start_kernel(void * dtb)
env().scheduler.schedule();
}
extern "C" void lx_emul_execute_kernel_until(int (*condition)(void))
{
Lx_kit::env().scheduler.schedule();
while (!condition()) {
Lx_kit::env().env.ep().wait_and_dispatch_one_io_signal();
}
}