mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
parent
ee564125df
commit
6e30d00eef
@ -25,6 +25,7 @@
|
||||
|
||||
#include <base/rpc_client.h>
|
||||
#include <base/thread.h>
|
||||
#include <cpu_session/cpu_session.h>
|
||||
#include <signal_source/foc_signal_source.h>
|
||||
|
||||
namespace Genode { class Signal_source_client; }
|
||||
@ -44,7 +45,7 @@ class Genode::Signal_source_client : public Rpc_client<Foc_signal_source>
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Signal_source_client(Capability<Signal_source> cap);
|
||||
Signal_source_client(Cpu_session &, Capability<Signal_source> cap);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -15,9 +15,6 @@
|
||||
/* Genode includes */
|
||||
#include <signal_source/client.h>
|
||||
#include <base/thread.h>
|
||||
#include <base/env.h>
|
||||
#include <base/log.h>
|
||||
#include <deprecated/env.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/capability_data.h>
|
||||
@ -30,7 +27,7 @@
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
Signal_source_client::Signal_source_client(Capability<Signal_source> cap)
|
||||
Signal_source_client::Signal_source_client(Cpu_session &cpu, Capability<Signal_source> cap)
|
||||
:
|
||||
Rpc_client<Foc_signal_source>(static_cap_cast<Foc_signal_source>(cap)),
|
||||
|
||||
@ -39,7 +36,7 @@ Signal_source_client::Signal_source_client(Capability<Signal_source> cap)
|
||||
{
|
||||
using namespace Foc;
|
||||
|
||||
Foc_native_cpu_client cpu_client(env_deprecated()->cpu_session()->native_cpu());
|
||||
Foc_native_cpu_client cpu_client(cpu.native_cpu());
|
||||
Native_capability thread_cap = cpu_client.native_cap(Thread::myself()->cap());
|
||||
l4_msgtag_t tag = l4_rcv_ep_bind_thread(_sem.data()->kcap(), thread_cap.data()->kcap(), 0);
|
||||
if (l4_error(tag))
|
||||
|
@ -47,7 +47,10 @@ void Genode::init_signal_thread(Env &env) { _pd_ptr = &env.pd(); }
|
||||
void Genode::destroy_signal_thread() { }
|
||||
|
||||
|
||||
Signal_receiver::Signal_receiver()
|
||||
void Genode::init_signal_receiver(Pd_session &, Parent &) { }
|
||||
|
||||
|
||||
Signal_receiver::Signal_receiver() : _pd(pd())
|
||||
{
|
||||
for (;;) {
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/* Genode includes */
|
||||
#include <base/rpc_client.h>
|
||||
#include <cpu_session/cpu_session.h>
|
||||
#include <signal_source/nova_signal_source.h>
|
||||
|
||||
/* base-internal includes */
|
||||
@ -49,7 +50,7 @@ namespace Genode {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Signal_source_client(Capability<Signal_source> cap)
|
||||
Signal_source_client(Cpu_session &, Capability<Signal_source> cap)
|
||||
: Rpc_client<Nova_signal_source>(static_cap_cast<Nova_signal_source>(cap))
|
||||
{
|
||||
/* request mapping of semaphore capability selector */
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <base/internal/capability_space_sel4.h>
|
||||
#include <base/log.h>
|
||||
#include <signal_source/sel4_signal_source.h>
|
||||
#include <cpu_session/cpu_session.h>
|
||||
|
||||
namespace Genode { class Signal_source_client; }
|
||||
|
||||
@ -38,9 +39,12 @@ class Genode::Signal_source_client : public Rpc_client<SeL4_signal_source>
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Signal_source_client(Capability<Signal_source> cap)
|
||||
: Rpc_client<SeL4_signal_source>(static_cap_cast<SeL4_signal_source>(cap))
|
||||
{ _init_notify(); }
|
||||
Signal_source_client(Cpu_session &, Capability<Signal_source> cap)
|
||||
:
|
||||
Rpc_client<SeL4_signal_source>(static_cap_cast<SeL4_signal_source>(cap))
|
||||
{
|
||||
_init_notify();
|
||||
}
|
||||
|
||||
|
||||
/*****************************
|
||||
|
@ -30,6 +30,7 @@ namespace Genode {
|
||||
|
||||
class Entrypoint;
|
||||
class Rpc_entrypoint;
|
||||
class Pd_session;
|
||||
class Signal_source;
|
||||
|
||||
class Signal_receiver;
|
||||
@ -314,6 +315,8 @@ class Genode::Signal_receiver : Noncopyable
|
||||
}
|
||||
};
|
||||
|
||||
Pd_session &_pd;
|
||||
|
||||
/**
|
||||
* Semaphore used to indicate that signal(s) are ready to be picked
|
||||
* up. This is needed for platforms other than 'base-hw' only.
|
||||
|
@ -28,18 +28,33 @@
|
||||
using namespace Core;
|
||||
|
||||
|
||||
Signal_receiver::Signal_receiver() { }
|
||||
static Pd_session *_pd_ptr;
|
||||
|
||||
|
||||
Signal_receiver::Signal_receiver() : _pd(*_pd_ptr)
|
||||
{
|
||||
if (!_pd_ptr) {
|
||||
struct Missing_call_of_init_signal_receiver { };
|
||||
for(;;);
|
||||
throw Missing_call_of_init_signal_receiver();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Signal_receiver::_platform_destructor() { }
|
||||
void Signal_receiver::_platform_begin_dissolve (Signal_context *) { }
|
||||
void Signal_receiver::_platform_finish_dissolve(Signal_context *) { }
|
||||
|
||||
|
||||
void Signal_receiver::unblock_signal_waiter(Rpc_entrypoint &) { ASSERT_NEVER_CALLED; }
|
||||
|
||||
|
||||
typedef Signal_context_capability Sigh_cap;
|
||||
|
||||
|
||||
Sigh_cap Signal_receiver::manage(Signal_context *) { ASSERT_NEVER_CALLED; }
|
||||
|
||||
|
||||
void Signal_receiver::block_for_signal()
|
||||
{
|
||||
/*
|
||||
@ -51,7 +66,12 @@ void Signal_receiver::block_for_signal()
|
||||
sleep_forever();
|
||||
}
|
||||
|
||||
|
||||
Signal Signal_receiver::pending_signal() {
|
||||
return Signal(); }
|
||||
|
||||
|
||||
void Signal_receiver::local_submit(Signal::Data) { ASSERT_NEVER_CALLED; }
|
||||
|
||||
|
||||
void Genode::init_signal_receiver(Pd_session &pd, Parent &) { _pd_ptr = &pd; }
|
||||
|
@ -30,6 +30,7 @@ namespace Genode {
|
||||
void init_stack_area();
|
||||
void init_exception_handling(Env &);
|
||||
void init_signal_transmitter(Env &);
|
||||
void init_signal_receiver(Pd_session &, Parent &);
|
||||
void init_cxx_heap(Env &);
|
||||
void init_cxx_guard();
|
||||
void init_ldso_phdr(Env &);
|
||||
|
@ -16,13 +16,14 @@
|
||||
|
||||
#include <base/rpc_client.h>
|
||||
#include <pd_session/pd_session.h>
|
||||
#include <cpu_session/cpu_session.h>
|
||||
#include <signal_source/signal_source.h>
|
||||
|
||||
namespace Genode { class Signal_source_client; }
|
||||
|
||||
struct Genode::Signal_source_client : Rpc_client<Signal_source>
|
||||
{
|
||||
Signal_source_client(Capability<Signal_source> signal_source)
|
||||
Signal_source_client(Cpu_session &, Capability<Signal_source> signal_source)
|
||||
: Rpc_client<Signal_source>(signal_source) { }
|
||||
|
||||
Signal wait_for_signal() override { return call<Rpc_wait_for_signal>(); }
|
||||
|
@ -243,6 +243,7 @@ struct Genode::Startup
|
||||
::Env env { ep };
|
||||
|
||||
bool const exception_handling = (init_exception_handling(env), true);
|
||||
bool const signal_receiver = (init_signal_receiver(env.pd(), env.parent()), true);
|
||||
|
||||
/*
|
||||
* The construction of the main entrypoint does never return.
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <base/sleep.h>
|
||||
#include <base/trace/events.h>
|
||||
#include <util/reconstructible.h>
|
||||
#include <deprecated/env.h>
|
||||
|
||||
/* base-internal includes */
|
||||
#include <base/internal/globals.h>
|
||||
@ -28,10 +27,14 @@
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
|
||||
class Signal_handler_thread : Thread, Blockade
|
||||
{
|
||||
private:
|
||||
|
||||
Pd_session &_pd;
|
||||
Cpu_session &_cpu;
|
||||
|
||||
/**
|
||||
* Actual signal source
|
||||
*
|
||||
@ -43,7 +46,7 @@ class Signal_handler_thread : Thread, Blockade
|
||||
|
||||
void entry() override
|
||||
{
|
||||
_signal_source.construct(env_deprecated()->pd_session()->alloc_signal_source());
|
||||
_signal_source.construct(_cpu, _pd.alloc_signal_source());
|
||||
wakeup();
|
||||
Signal_receiver::dispatch_signals(&(*_signal_source));
|
||||
}
|
||||
@ -56,7 +59,8 @@ class Signal_handler_thread : Thread, Blockade
|
||||
* Constructor
|
||||
*/
|
||||
Signal_handler_thread(Env &env)
|
||||
: Thread(env, "signal handler", STACK_SIZE)
|
||||
:
|
||||
Thread(env, "signal handler", STACK_SIZE), _pd(env.pd()), _cpu(env.cpu())
|
||||
{
|
||||
start();
|
||||
|
||||
@ -70,7 +74,7 @@ class Signal_handler_thread : Thread, Blockade
|
||||
|
||||
~Signal_handler_thread()
|
||||
{
|
||||
env_deprecated()->pd_session()->free_signal_source(_signal_source->rpc_cap());
|
||||
_pd.free_signal_source(_signal_source->rpc_cap());
|
||||
}
|
||||
};
|
||||
|
||||
@ -202,7 +206,17 @@ Genode::Signal_context_registry *signal_context_registry()
|
||||
** Signal receiver **
|
||||
*********************/
|
||||
|
||||
Signal_receiver::Signal_receiver() { }
|
||||
static Pd_session *_pd_ptr;
|
||||
static Parent *_parent_ptr;
|
||||
|
||||
|
||||
Signal_receiver::Signal_receiver() : _pd(*_pd_ptr)
|
||||
{
|
||||
if (!_pd_ptr) {
|
||||
struct Missing_call_of_init_signal_receiver { };
|
||||
throw Missing_call_of_init_signal_receiver();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Signal_context_capability Signal_receiver::manage(Signal_context *context)
|
||||
@ -227,7 +241,7 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
|
||||
|
||||
try {
|
||||
/* use signal context as imprint */
|
||||
context->_cap = env_deprecated()->pd_session()->alloc_context(_cap, (long)context);
|
||||
context->_cap = _pd.alloc_context(_cap, (long)context);
|
||||
break;
|
||||
}
|
||||
catch (Out_of_ram) { ram_upgrade = Ram_quota { 1024*sizeof(long) }; }
|
||||
@ -236,9 +250,9 @@ Signal_context_capability Signal_receiver::manage(Signal_context *context)
|
||||
log("upgrading quota donation for PD session "
|
||||
"(", ram_upgrade, " bytes, ", cap_upgrade, " caps)");
|
||||
|
||||
env_deprecated()->parent()->upgrade(Parent::Env::pd(),
|
||||
String<100>("ram_quota=", ram_upgrade, ", "
|
||||
"cap_quota=", cap_upgrade).string());
|
||||
_parent_ptr->upgrade(Parent::Env::pd(),
|
||||
String<100>("ram_quota=", ram_upgrade, ", "
|
||||
"cap_quota=", cap_upgrade).string());
|
||||
}
|
||||
|
||||
return context->_cap;
|
||||
@ -360,3 +374,10 @@ void Signal_receiver::_platform_finish_dissolve(Signal_context *) { }
|
||||
|
||||
|
||||
void Signal_receiver::_platform_destructor() { }
|
||||
|
||||
|
||||
void Genode::init_signal_receiver(Pd_session &pd, Parent &parent)
|
||||
{
|
||||
_pd_ptr = &pd;
|
||||
_parent_ptr = &parent;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <base/env.h>
|
||||
#include <base/signal.h>
|
||||
#include <base/trace/events.h>
|
||||
#include <deprecated/env.h>
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
@ -178,7 +177,7 @@ Signal_receiver::~Signal_receiver()
|
||||
void Signal_receiver::_unsynchronized_dissolve(Signal_context * const context)
|
||||
{
|
||||
/* tell core to stop sending signals referring to the context */
|
||||
env_deprecated()->pd_session()->free_context(context->_cap);
|
||||
_pd.free_context(context->_cap);
|
||||
|
||||
/* restore default initialization of signal context */
|
||||
context->_receiver = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user