mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-31 22:50:54 +00:00
parent
b1a27b417b
commit
c2950e13eb
@ -71,8 +71,7 @@ Signal_source::Signal Signal_source_component::wait_for_signal()
|
|||||||
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
||||||
:
|
:
|
||||||
Signal_source_rpc_object(*cap_map()->insert(platform_specific()->cap_id_alloc()->alloc())),
|
Signal_source_rpc_object(*cap_map()->insert(platform_specific()->cap_id_alloc()->alloc())),
|
||||||
_entrypoint(ep), _finalizer(*this),
|
_entrypoint(ep)
|
||||||
_finalizer_cap(_entrypoint->manage(&_finalizer))
|
|
||||||
{
|
{
|
||||||
using namespace Fiasco;
|
using namespace Fiasco;
|
||||||
|
|
||||||
@ -84,13 +83,6 @@ Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
|||||||
|
|
||||||
|
|
||||||
Signal_source_component::~Signal_source_component()
|
Signal_source_component::~Signal_source_component()
|
||||||
{
|
|
||||||
_finalizer_cap.call<Finalizer::Rpc_exit>();
|
|
||||||
_entrypoint->dissolve(&_finalizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Signal_source_component::Finalizer_component::exit()
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* On Fiasco.OC, the signal-source client does not use a blocking call
|
* On Fiasco.OC, the signal-source client does not use a blocking call
|
||||||
|
@ -70,8 +70,7 @@ Signal_source::Signal Signal_source_component::wait_for_signal()
|
|||||||
|
|
||||||
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
||||||
:
|
:
|
||||||
_entrypoint(ep), _finalizer(*this),
|
_entrypoint(ep)
|
||||||
_finalizer_cap(_entrypoint->manage(&_finalizer))
|
|
||||||
{
|
{
|
||||||
Platform &platform = *platform_specific();
|
Platform &platform = *platform_specific();
|
||||||
Range_allocator &phys_alloc = *platform.ram_alloc();
|
Range_allocator &phys_alloc = *platform.ram_alloc();
|
||||||
@ -87,11 +86,4 @@ Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Signal_source_component::~Signal_source_component()
|
Signal_source_component::~Signal_source_component() { }
|
||||||
{
|
|
||||||
_finalizer_cap.call<Finalizer::Rpc_exit>();
|
|
||||||
_entrypoint->dissolve(&_finalizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Signal_source_component::Finalizer_component::exit() { }
|
|
||||||
|
@ -75,44 +75,11 @@ class Genode::Signal_context_component : public Rpc_object<Signal_context>,
|
|||||||
|
|
||||||
class Genode::Signal_source_component : public Signal_source_rpc_object
|
class Genode::Signal_source_component : public Signal_source_rpc_object
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Helper for clean destruction of signal-receiver component
|
|
||||||
*
|
|
||||||
* Normally, reply capabilities are implicitly destroyed when answering
|
|
||||||
* an RPC call. But when destructing a signal session while a signal-
|
|
||||||
* receiver client is blocking on a 'wait_for_signal' call, this
|
|
||||||
* blocking call will never return via the normal control flow
|
|
||||||
* (signal submission). In this case, the reply capability would
|
|
||||||
* outlive the signal session. To avoid the leakage of such reply
|
|
||||||
* capabilities, we let the signal-session destructor perform a
|
|
||||||
* core-local RPC call to the so-called 'Finalizer' object, which has
|
|
||||||
* the sole purpose of replying to the last outstanding
|
|
||||||
* 'wait_for_signal' call and thereby releasing the corresponding
|
|
||||||
* reply capability.
|
|
||||||
*/
|
|
||||||
struct Finalizer
|
|
||||||
{
|
|
||||||
GENODE_RPC(Rpc_exit, void, exit);
|
|
||||||
GENODE_RPC_INTERFACE(Rpc_exit);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Finalizer_component : Rpc_object<Finalizer, Finalizer_component>
|
|
||||||
{
|
|
||||||
Signal_source_component &source;
|
|
||||||
|
|
||||||
Finalizer_component(Signal_source_component &source)
|
|
||||||
: source(source) { }
|
|
||||||
|
|
||||||
void exit();
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Signal_queue _signal_queue;
|
Signal_queue _signal_queue;
|
||||||
Rpc_entrypoint *_entrypoint;
|
Rpc_entrypoint *_entrypoint;
|
||||||
Native_capability _reply_cap;
|
Native_capability _reply_cap;
|
||||||
Finalizer_component _finalizer;
|
|
||||||
Capability<Finalizer> _finalizer_cap;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class Genode::Trace::Session_component
|
|||||||
ram(ram),
|
ram(ram),
|
||||||
ds(ram.alloc(size)),
|
ds(ram.alloc(size)),
|
||||||
base(env_deprecated()->rm_session()->attach(ds)),
|
base(env_deprecated()->rm_session()->attach(ds)),
|
||||||
size(ds.call<Dataspace::Rpc_size>())
|
size(ram.dataspace_size(ds))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~Argument_buffer()
|
~Argument_buffer()
|
||||||
|
@ -106,12 +106,6 @@ class Core_child : public Child_policy
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/*
|
|
||||||
* Entry point used for serving the parent interface
|
|
||||||
*/
|
|
||||||
Rpc_entrypoint _entrypoint;
|
|
||||||
enum { STACK_SIZE = 4 * 1024 * sizeof(Genode::addr_t)};
|
|
||||||
|
|
||||||
Registry<Service> &_services;
|
Registry<Service> &_services;
|
||||||
|
|
||||||
Capability<Pd_session> _core_pd_cap;
|
Capability<Pd_session> _core_pd_cap;
|
||||||
@ -133,18 +127,16 @@ class Core_child : public Child_policy
|
|||||||
Core_child(Registry<Service> &services, Region_map &local_rm,
|
Core_child(Registry<Service> &services, Region_map &local_rm,
|
||||||
Pd_session &core_pd, Capability<Pd_session> core_pd_cap,
|
Pd_session &core_pd, Capability<Pd_session> core_pd_cap,
|
||||||
Cpu_session &core_cpu, Capability<Cpu_session> core_cpu_cap,
|
Cpu_session &core_cpu, Capability<Cpu_session> core_cpu_cap,
|
||||||
Cap_quota cap_quota, Ram_quota ram_quota)
|
Cap_quota cap_quota, Ram_quota ram_quota,
|
||||||
|
Rpc_entrypoint &ep)
|
||||||
:
|
:
|
||||||
_entrypoint(nullptr, STACK_SIZE, "init_child", false),
|
|
||||||
_services(services),
|
_services(services),
|
||||||
_core_pd_cap (core_pd_cap), _core_pd (core_pd),
|
_core_pd_cap (core_pd_cap), _core_pd (core_pd),
|
||||||
_core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu),
|
_core_cpu_cap(core_cpu_cap), _core_cpu(core_cpu),
|
||||||
_cap_quota(Child::effective_quota(cap_quota)),
|
_cap_quota(Child::effective_quota(cap_quota)),
|
||||||
_ram_quota(Child::effective_quota(ram_quota)),
|
_ram_quota(Child::effective_quota(ram_quota)),
|
||||||
_child(local_rm, _entrypoint, *this)
|
_child(local_rm, ep, *this)
|
||||||
{
|
{ }
|
||||||
_entrypoint.activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************
|
/****************************
|
||||||
@ -314,7 +306,7 @@ int main()
|
|||||||
|
|
||||||
static Reconstructible<Core_child>
|
static Reconstructible<Core_child>
|
||||||
init(services, local_rm, core_pd, core_pd_cap, core_cpu, core_cpu_cap,
|
init(services, local_rm, core_pd, core_pd_cap, core_cpu, core_cpu_cap,
|
||||||
init_cap_quota, init_ram_quota);
|
init_cap_quota, init_ram_quota, ep);
|
||||||
|
|
||||||
platform()->wait_for_exit();
|
platform()->wait_for_exit();
|
||||||
|
|
||||||
|
@ -88,23 +88,15 @@ Signal_source::Signal Signal_source_component::wait_for_signal()
|
|||||||
|
|
||||||
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
Signal_source_component::Signal_source_component(Rpc_entrypoint *ep)
|
||||||
:
|
:
|
||||||
_entrypoint(ep), _finalizer(*this),
|
_entrypoint(ep)
|
||||||
_finalizer_cap(_entrypoint->manage(&_finalizer))
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
Signal_source_component::~Signal_source_component()
|
Signal_source_component::~Signal_source_component()
|
||||||
{
|
{
|
||||||
_finalizer_cap.call<Finalizer::Rpc_exit>();
|
if (!_reply_cap.valid())
|
||||||
_entrypoint->dissolve(&_finalizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Signal_source_component::Finalizer_component::exit()
|
|
||||||
{
|
|
||||||
if (!source._reply_cap.valid())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
source._entrypoint->reply_signal_info(source._reply_cap, 0, 0);
|
_entrypoint->reply_signal_info(_reply_cap, 0, 0);
|
||||||
source._reply_cap = Untyped_capability();
|
_reply_cap = Untyped_capability();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user