Besides adapting the components to the use of base/log.h, the patch cleans up a few base headers, i.e., it removes unused includes from root/component.h, specifically base/heap.h and ram_session/ram_session.h. Hence, components that relied on the implicit inclusion of those headers have to manually include those headers now. While adjusting the log messages, I repeatedly stumbled over the problem that printing char * arguments is ambiguous. It is unclear whether to print the argument as pointer or null-terminated string. To overcome this problem, the patch introduces a new type 'Cstring' that allows the caller to express that the argument should be handled as null-terminated string. As a nice side effect, with this type in place, the optional len argument of the 'String' class could be removed. Instead of supplying a pair of (char const *, size_t), the constructor accepts a 'Cstring'. This, in turn, clears the way let the 'String' constructor use the new output mechanism to assemble a string from multiple arguments (and thereby getting rid of snprintf within Genode in the near future). To enforce the explicit resolution of the char * ambiguity, the 'char *' overload of the 'print' function is marked as deleted. Issue #1987
116 lines
2.6 KiB
C++
116 lines
2.6 KiB
C++
/*
|
|
* \brief Core-specific pseudo PD session
|
|
* \author Norman Feske
|
|
* \date 2016-01-13
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2015 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
#ifndef _CORE__INCLUDE__CORE_PD_SESSION_H_
|
|
#define _CORE__INCLUDE__CORE_PD_SESSION_H_
|
|
|
|
/* Genode includes */
|
|
#include <base/rpc_server.h>
|
|
#include <base/allocator.h>
|
|
#include <pd_session/pd_session.h>
|
|
|
|
/* core includes */
|
|
#include <assertion.h>
|
|
#include <signal_source_component.h>
|
|
|
|
namespace Genode { class Core_pd_session_component; }
|
|
|
|
|
|
class Genode::Core_pd_session_component : public Rpc_object<Pd_session>
|
|
{
|
|
private:
|
|
|
|
Rpc_entrypoint &_signal_source_ep;
|
|
|
|
public:
|
|
|
|
/**
|
|
* Constructor
|
|
*
|
|
* \param context_ep entrypoint that serves the signal-source
|
|
* components
|
|
*/
|
|
Core_pd_session_component(Rpc_entrypoint &signal_source_ep)
|
|
:
|
|
_signal_source_ep(signal_source_ep)
|
|
{ }
|
|
|
|
void assign_parent(Capability<Parent> parent) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
bool assign_pci(addr_t pci_config_memory_address, uint16_t) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
Signal_source_capability alloc_signal_source() override
|
|
{
|
|
/*
|
|
* Even though core does not receive any signals, this function is
|
|
* called by the base-common initialization code on base-hw. We
|
|
* can savely return an invalid capability as it is never used.
|
|
*/
|
|
return Signal_source_capability();
|
|
}
|
|
|
|
void free_signal_source(Signal_source_capability cap) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
Capability<Signal_context>
|
|
alloc_context(Signal_source_capability source, unsigned long imprint) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
void free_context(Capability<Signal_context> cap) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
void submit(Capability<Signal_context> cap, unsigned cnt = 1) override
|
|
{
|
|
_signal_source_ep.apply(cap, [&] (Signal_context_component *context) {
|
|
if (!context) {
|
|
warning("invalid signal-context capability");
|
|
return;
|
|
}
|
|
|
|
context->source()->submit(context, cnt);
|
|
});
|
|
}
|
|
|
|
Native_capability alloc_rpc_cap(Native_capability) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
void free_rpc_cap(Native_capability) override
|
|
{
|
|
ASSERT_NEVER_CALLED;
|
|
}
|
|
|
|
Capability<Region_map> address_space() { ASSERT_NEVER_CALLED; }
|
|
|
|
Capability<Region_map> stack_area() { ASSERT_NEVER_CALLED; }
|
|
|
|
Capability<Region_map> linker_area() { ASSERT_NEVER_CALLED; }
|
|
|
|
Capability<Native_pd> native_pd() override { ASSERT_NEVER_CALLED; }
|
|
};
|
|
|
|
#endif /* _CORE__INCLUDE__CORE_PD_SESSION_H_ */
|