L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Util::Object_registry Class Reference

A registry that manages server objects and their attached IPC gates for a single server loop for a specific thread. More...

#include <object_registry>

+ Inheritance diagram for L4Re::Util::Object_registry:
+ Collaboration diagram for L4Re::Util::Object_registry:

Public Member Functions

 Object_registry (L4::Ipc_svr::Server_iface *sif)
 Create a registry for the main thread of the task using the default factory.
 
 Object_registry (L4::Ipc_svr::Server_iface *sif, L4::Cap< L4::Thread > server, L4::Cap< L4::Factory > factory)
 Create a registry for arbitrary threads.
 
L4::Cap< void > register_obj (L4::Epiface *o, char const *service) override
 Register a new server object to a pre-allocated receive endpoint.
 
L4::Cap< void > register_obj (L4::Epiface *o) override
 Register a new server object on a newly allocated capability.
 
L4::Cap< L4::Irqregister_irq_obj (L4::Epiface *o) override
 Register a handler for an interrupt.
 
L4::Cap< L4::Rcv_endpointregister_obj (L4::Epiface *o, L4::Cap< L4::Rcv_endpoint > ep) override
 Register a handler for an already existing interrupt.
 
void unregister_obj (L4::Epiface *o, bool unmap=true) override
 Remove a server object from the handler list.
 

Additional Inherited Members

- Static Public Member Functions inherited from L4::Basic_registry
static Valuefind (l4_umword_t label)
 Get the server object for an Ipc_gate label.
 
static l4_msgtag_t dispatch (l4_msgtag_t tag, l4_umword_t label, l4_utcb_t *utcb)
 The dispatch function called by the server loop.
 

Detailed Description

A registry that manages server objects and their attached IPC gates for a single server loop for a specific thread.

This class manages most of the setup of a server object. If necessary, an IPC gate is created, the specified thread is bound to the IPC gate. Incoming IPC is dispatched to the server object based on the label of the IPC gate.

The object registry is also able to manage IRQ endpoints. They require a different method for the object creation. Otherwise they are handled in the same way as IPC gates: a server object is responsible to process the incoming interrupts.

Definition at line 52 of file object_registry.

Constructor & Destructor Documentation

◆ Object_registry() [1/2]

L4Re::Util::Object_registry::Object_registry ( L4::Ipc_svr::Server_iface sif)
inlineexplicit

Create a registry for the main thread of the task using the default factory.

Parameters
sifServer loop interface.

Definition at line 78 of file object_registry.

◆ Object_registry() [2/2]

L4Re::Util::Object_registry::Object_registry ( L4::Ipc_svr::Server_iface sif,
L4::Cap< L4::Thread server,
L4::Cap< L4::Factory factory 
)
inline

Create a registry for arbitrary threads.

Parameters
sifServer loop interface.
serverCapability to the thread that executes the server objects.
factoryCapability to a factory object capable of creating new IPC gates.

Definition at line 92 of file object_registry.

Member Function Documentation

◆ register_irq_obj()

L4::Cap< L4::Irq > L4Re::Util::Object_registry::register_irq_obj ( L4::Epiface o)
inlineoverridevirtual

Register a handler for an interrupt.

Parameters
oServer object that handles IRQs.
Return values
L4::Cap<L4::Irq>Capability to a new IRQ object on success.
L4::Cap<L4::Irq>::InvalidThe allocation of the IRQ has failed.

The IRQ will be newly allocated using the registry's factory object. The caller must call unregister_obj() to free all resources.

Implements L4::Registry_iface.

Definition at line 238 of file object_registry.

◆ register_obj() [1/3]

L4::Cap< void > L4Re::Util::Object_registry::register_obj ( L4::Epiface o)
inlineoverridevirtual

Register a new server object on a newly allocated capability.

Parameters
oServer object that handles IPC requests.
Return values
L4::Cap<void>A valid capability to a new IPC gate.
L4::Cap<void>::InvalidThe allocation of the IPC gate has failed.

The IPC gate will be allocated using the registry's factory. The caller must call unregister_obj() to free all resources.

Implements L4::Registry_iface.

Definition at line 222 of file object_registry.

◆ register_obj() [2/3]

L4::Cap< void > L4Re::Util::Object_registry::register_obj ( L4::Epiface o,
char const *  service 
)
inlineoverridevirtual

Register a new server object to a pre-allocated receive endpoint.

Parameters
oServer object that handles IPC requests.
serviceName of a pre-allocated receive endpoint.
Return values
L4::Cap<void>The capability known as service on success.
L4::Cap<void>::InvalidNo capability with the given name found.

The interface must be freed with unregister_obj() by the caller to unbind the thread from the capability.

Implements L4::Registry_iface.

Examples
examples/clntsrv/server.cc, and examples/libs/l4re/streammap/server.cc.

Definition at line 205 of file object_registry.

◆ register_obj() [3/3]

L4::Cap< L4::Rcv_endpoint > L4Re::Util::Object_registry::register_obj ( L4::Epiface o,
L4::Cap< L4::Rcv_endpoint ep 
)
inlineoverridevirtual

Register a handler for an already existing interrupt.

Parameters
oServer object that handles the IPC.
epCapability to a receive endpoint, may be a hardware or software interrupt or an IPC gate.
Return values
L4::Cap<L4::Rcv_endpoint>Capability ep on success.
L4::Cap<L4::Rcv_endpoint>::InvalidThe IRQ attach operation has failed.

The interface must be freed with unregister_obj() by the caller to unbind the thread from the capability.

Implements L4::Registry_iface.

Definition at line 260 of file object_registry.

◆ unregister_obj()

void L4Re::Util::Object_registry::unregister_obj ( L4::Epiface o,
bool  unmap = true 
)
inlineoverridevirtual

Remove a server object from the handler list.

Parameters
oServer object to unbind.
unmapSpecifies if the object capability shall be unmapped (true) or not. The default (true) is to unmap the capability.

The capability used by the server object will be unmapped if unmap is true.

Implements L4::Registry_iface.

Definition at line 276 of file object_registry.

References L4::Thread::Modify_senders::add(), L4Re::Util::cap_alloc, L4_FP_ALL_SPACES, L4::Epiface::obj_cap(), and L4::Epiface::set_server().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: