2015-02-19 14:50:27 +01:00
|
|
|
/*
|
|
|
|
* \brief Platform specific services for Arndale
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2014-07-08
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2014-2017 Genode Labs GmbH
|
2015-02-19 14:50:27 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2015-02-19 14:50:27 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <base/service.h>
|
base: avoid use of deprecated base/printf.h
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
2016-07-13 19:07:09 +02:00
|
|
|
#include <base/heap.h>
|
2015-02-19 14:50:27 +01:00
|
|
|
|
2016-11-06 14:26:34 +01:00
|
|
|
/* core includes */
|
2017-04-28 15:27:26 +02:00
|
|
|
#include <platform.h>
|
2015-02-19 14:50:27 +01:00
|
|
|
#include <platform_services.h>
|
2018-09-26 15:53:18 +02:00
|
|
|
#include <core_env.h>
|
2017-05-11 00:07:54 +02:00
|
|
|
#include <core_service.h>
|
2016-11-07 18:00:24 +01:00
|
|
|
#include <map_local.h>
|
2015-02-19 14:50:27 +01:00
|
|
|
#include <vm_root.h>
|
2017-03-23 03:06:53 +01:00
|
|
|
#include <platform.h>
|
2015-02-19 14:50:27 +01:00
|
|
|
|
2017-06-30 12:00:27 +02:00
|
|
|
extern Genode::addr_t hypervisor_exception_vector;
|
2015-02-19 14:50:27 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Add ARM virtualization specific vm service
|
|
|
|
*/
|
base/core: use references instead of pointers
This patch replaces the former prominent use of pointers by references
wherever feasible. This has the following benefits:
* The contract between caller and callee becomes more obvious. When
passing a reference, the contract says that the argument cannot be
a null pointer. The caller is responsible to ensure that. Therefore,
the use of reference eliminates the need to add defensive null-pointer
checks at the callee site, which sometimes merely exist to be on the
safe side. The bottom line is that the code becomes easier to follow.
* Reference members must be initialized via an object initializer,
which promotes a programming style that avoids intermediate object-
construction states. Within core, there are still a few pointers
as member variables left though. E.g., caused by the late association
of 'Platform_thread' objects with their 'Platform_pd' objects.
* If no pointers are present as member variables, we don't need to
manually provide declarations of a private copy constructor and
an assignment operator to avoid -Weffc++ errors "class ... has
pointer data members [-Werror=effc++]".
This patch also changes a few system bindings on NOVA and Fiasco.OC,
e.g., the return value of the global 'cap_map' accessor has become a
reference. Hence, the patch touches a few places outside of core.
Fixes #3135
2019-01-24 22:00:01 +01:00
|
|
|
void Genode::platform_add_local_services(Rpc_entrypoint &ep,
|
|
|
|
Sliced_heap &sh,
|
|
|
|
Registry<Service> &services)
|
2015-02-19 14:50:27 +01:00
|
|
|
{
|
|
|
|
using namespace Genode;
|
|
|
|
|
2017-06-30 12:00:27 +02:00
|
|
|
map_local(Platform::core_phys_addr((addr_t)&hypervisor_exception_vector),
|
|
|
|
Hw::Mm::hypervisor_exception_vector().base, 1,
|
|
|
|
Hw::PAGE_FLAGS_KERN_TEXT);
|
2016-11-07 18:00:24 +01:00
|
|
|
|
2018-09-26 15:53:18 +02:00
|
|
|
static Vm_root vm_root(ep, sh, core_env().ram_allocator(),
|
|
|
|
core_env().local_rm());
|
base/core: use references instead of pointers
This patch replaces the former prominent use of pointers by references
wherever feasible. This has the following benefits:
* The contract between caller and callee becomes more obvious. When
passing a reference, the contract says that the argument cannot be
a null pointer. The caller is responsible to ensure that. Therefore,
the use of reference eliminates the need to add defensive null-pointer
checks at the callee site, which sometimes merely exist to be on the
safe side. The bottom line is that the code becomes easier to follow.
* Reference members must be initialized via an object initializer,
which promotes a programming style that avoids intermediate object-
construction states. Within core, there are still a few pointers
as member variables left though. E.g., caused by the late association
of 'Platform_thread' objects with their 'Platform_pd' objects.
* If no pointers are present as member variables, we don't need to
manually provide declarations of a private copy constructor and
an assignment operator to avoid -Weffc++ errors "class ... has
pointer data members [-Werror=effc++]".
This patch also changes a few system bindings on NOVA and Fiasco.OC,
e.g., the return value of the global 'cap_map' accessor has become a
reference. Hence, the patch touches a few places outside of core.
Fixes #3135
2019-01-24 22:00:01 +01:00
|
|
|
static Core_service<Vm_session_component> vm_service(services, vm_root);
|
2015-02-19 14:50:27 +01:00
|
|
|
}
|