2012-05-30 20:13:09 +02:00
|
|
|
/*
|
|
|
|
* \brief Protection-domain facility
|
|
|
|
* \author Martin Stein
|
2014-04-28 21:31:57 +02:00
|
|
|
* \author Stefan Kalkowski
|
2016-02-11 11:59:31 +01:00
|
|
|
* \author Sebastian Sumpf
|
2012-05-30 20:13:09 +02:00
|
|
|
* \date 2012-02-12
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2012-2017 Genode Labs GmbH
|
2012-05-30 20:13:09 +02: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.
|
2012-05-30 20:13:09 +02:00
|
|
|
*/
|
|
|
|
|
2015-05-19 14:18:40 +02:00
|
|
|
/* Genode includes */
|
|
|
|
#include <root/root.h>
|
|
|
|
|
2012-05-30 20:13:09 +02:00
|
|
|
/* core includes */
|
2017-02-21 13:46:59 +01:00
|
|
|
#include <hw/assert.h>
|
2012-05-30 20:13:09 +02:00
|
|
|
#include <platform_pd.h>
|
2015-05-19 14:18:40 +02:00
|
|
|
#include <platform_thread.h>
|
2012-05-30 20:13:09 +02:00
|
|
|
|
|
|
|
using namespace Genode;
|
2017-02-21 13:46:59 +01:00
|
|
|
using Hw::Page_table;
|
2012-05-30 20:13:09 +02:00
|
|
|
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
/**************************************
|
|
|
|
** Hw::Address_space implementation **
|
|
|
|
**************************************/
|
|
|
|
|
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
|
|
|
Core_mem_allocator &Hw::Address_space::_cma() {
|
|
|
|
return static_cast<Core_mem_allocator &>(platform().core_mem_alloc()); }
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
|
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 *Hw::Address_space::_table_alloc()
|
2015-04-10 12:35:30 +02:00
|
|
|
{
|
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 * ret = nullptr;
|
|
|
|
if (!_cma().alloc_aligned(sizeof(Page_table), (void**)&ret,
|
|
|
|
Page_table::ALIGNM_LOG2).ok())
|
2017-05-08 14:32:03 +02:00
|
|
|
throw Insufficient_ram_quota();
|
2015-04-28 14:07:51 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2015-04-10 12:35:30 +02:00
|
|
|
|
|
|
|
|
2015-04-28 14:07:51 +02:00
|
|
|
bool Hw::Address_space::insert_translation(addr_t virt, addr_t phys,
|
|
|
|
size_t size, Page_flags flags)
|
|
|
|
{
|
|
|
|
try {
|
|
|
|
for (;;) {
|
|
|
|
try {
|
|
|
|
Lock::Guard guard(_lock);
|
2017-02-21 13:46:59 +01:00
|
|
|
_tt.insert_translation(virt, phys, size, flags, _tt_alloc);
|
2015-04-28 14:07:51 +02:00
|
|
|
return true;
|
2017-02-21 13:46:59 +01:00
|
|
|
} catch(Hw::Out_of_tables &) {
|
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
|
|
|
flush(platform().vm_start(), platform().vm_size());
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch(...) {
|
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
|
|
|
error("invalid mapping ", Hex(phys), " -> ", Hex(virt), " (", size, ")");
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
return false;
|
2015-04-10 12:35:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-08-14 11:32:07 +02:00
|
|
|
void Hw::Address_space::flush(addr_t virt, size_t size, Core_local_addr)
|
2015-04-28 14:07:51 +02:00
|
|
|
{
|
|
|
|
Lock::Guard guard(_lock);
|
|
|
|
|
|
|
|
try {
|
2017-02-21 13:46:59 +01:00
|
|
|
_tt.remove_translation(virt, size, _tt_alloc);
|
2019-10-16 15:07:11 +02:00
|
|
|
Kernel::invalidate_tlb(*_kobj, virt, size);
|
2015-04-28 14:07:51 +02:00
|
|
|
} catch(...) {
|
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
|
|
|
error("tried to remove invalid region!");
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-16 15:07:11 +02:00
|
|
|
Hw::Address_space::Address_space(Page_table & tt,
|
|
|
|
Page_table::Allocator & tt_alloc,
|
|
|
|
Platform_pd & pd)
|
|
|
|
: _tt(tt),
|
|
|
|
_tt_phys(Platform::core_page_table()),
|
|
|
|
_tt_alloc(tt_alloc),
|
|
|
|
_kobj(false, *(Page_table*)translation_table_phys(), pd) {}
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
|
2019-10-16 15:07:11 +02:00
|
|
|
Hw::Address_space::Address_space(Platform_pd & pd)
|
2017-06-30 12:00:27 +02:00
|
|
|
: _tt(*construct_at<Page_table>(_table_alloc(), *((Page_table*)Hw::Mm::core_page_tables().base))),
|
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
|
|
|
_tt_phys((addr_t)_cma().phys_addr(&_tt)),
|
2019-09-26 12:43:09 +02:00
|
|
|
_tt_array(new (_cma()) Array([] (void * virt) {
|
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
|
|
|
return (addr_t)_cma().phys_addr(virt);})),
|
2017-02-21 13:46:59 +01:00
|
|
|
_tt_alloc(_tt_array->alloc()),
|
2019-10-16 15:07:11 +02:00
|
|
|
_kobj(true, *(Page_table*)translation_table_phys(), pd) { }
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
|
2015-05-21 15:00:03 +02:00
|
|
|
Hw::Address_space::~Address_space()
|
|
|
|
{
|
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
|
|
|
flush(platform().vm_start(), platform().vm_size());
|
2017-02-21 13:46:59 +01:00
|
|
|
destroy(_cma(), _tt_array);
|
|
|
|
destroy(_cma(), &_tt);
|
2015-05-21 15:00:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-06-15 15:04:54 +02:00
|
|
|
/******************************
|
|
|
|
** Cap_space implementation **
|
|
|
|
******************************/
|
2015-05-19 14:18:40 +02:00
|
|
|
|
2016-06-15 15:04:54 +02:00
|
|
|
Cap_space::Cap_space() : _slab(nullptr, &_initial_sb) { }
|
2015-05-19 14:18:40 +02:00
|
|
|
|
|
|
|
|
2016-06-15 15:04:54 +02:00
|
|
|
void Cap_space::upgrade_slab(Allocator &alloc)
|
2015-05-19 14:18:40 +02:00
|
|
|
{
|
2017-06-13 14:54:08 +02:00
|
|
|
void * block = nullptr;
|
|
|
|
if (!alloc.alloc(SLAB_SIZE, &block))
|
|
|
|
throw Out_of_ram();
|
|
|
|
_slab.insert_sb(block);
|
2015-05-19 14:18:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-28 14:07:51 +02:00
|
|
|
/********************************
|
|
|
|
** Platform_pd implementation **
|
|
|
|
********************************/
|
|
|
|
|
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
|
|
|
bool Platform_pd::bind_thread(Platform_thread &t)
|
2015-04-28 14:07:51 +02:00
|
|
|
{
|
|
|
|
/* is this the first and therefore main thread in this PD? */
|
|
|
|
bool main_thread = !_thread_associated;
|
|
|
|
_thread_associated = true;
|
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
|
|
|
t.join_pd(this, main_thread, Address_space::weak_ptr());
|
2016-04-20 21:12:57 +02:00
|
|
|
return true;
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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 Platform_pd::unbind_thread(Platform_thread &t) {
|
|
|
|
t.join_pd(nullptr, false, Address_space::weak_ptr()); }
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
|
2016-04-14 16:29:07 +02:00
|
|
|
void Platform_pd::assign_parent(Native_capability parent)
|
2015-04-28 14:07:51 +02:00
|
|
|
{
|
2016-04-14 16:29:07 +02:00
|
|
|
if (!_parent.valid() && parent.valid())
|
|
|
|
_parent = parent;
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
|
2014-04-28 21:31:57 +02:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
Platform_pd::Platform_pd(Page_table & tt,
|
|
|
|
Page_table::Allocator & alloc)
|
2019-10-16 15:07:11 +02:00
|
|
|
: Hw::Address_space(tt, alloc, *this), _label("core") { }
|
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
|
|
|
|
|
|
|
|
|
|
|
Platform_pd::Platform_pd(Allocator &, char const *label)
|
2019-10-16 15:07:11 +02:00
|
|
|
: Hw::Address_space(*this), _label(label)
|
2015-04-28 14:07:51 +02:00
|
|
|
{
|
2019-10-16 15:07:11 +02:00
|
|
|
if (!_kobj.cap().valid()) {
|
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
|
|
|
error("failed to create kernel object");
|
Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.
Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.
This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-07 22:03:22 +02:00
|
|
|
throw Service_denied();
|
2015-04-28 14:07:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-25 08:59:33 +02:00
|
|
|
Platform_pd::~Platform_pd()
|
|
|
|
{
|
|
|
|
/* invalidate weak pointers to this object */
|
|
|
|
Address_space::lock_for_destruction();
|
|
|
|
}
|
|
|
|
|
2015-04-28 14:07:51 +02:00
|
|
|
|
|
|
|
/*************************************
|
|
|
|
** Core_platform_pd implementation **
|
|
|
|
*************************************/
|
|
|
|
|
|
|
|
Core_platform_pd::Core_platform_pd()
|
2017-06-20 15:25:04 +02:00
|
|
|
: Platform_pd(*(Hw::Page_table*)Hw::Mm::core_page_tables().base,
|
2017-06-30 12:00:27 +02:00
|
|
|
Platform::core_page_table_allocator()) { }
|