2012-05-30 20:13:09 +02:00
|
|
|
/*
|
|
|
|
* \brief Platform implementation specific for hw
|
|
|
|
* \author Martin Stein
|
2014-04-28 21:31:57 +02:00
|
|
|
* \author Stefan Kalkowski
|
2012-05-30 20:13:09 +02:00
|
|
|
* \date 2011-12-21
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2017-02-20 13:23:52 +01:00
|
|
|
* Copyright (C) 2011-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
|
|
|
*/
|
|
|
|
|
|
|
|
/* Genode includes */
|
2016-06-16 15:55:36 +02:00
|
|
|
#include <base/log.h>
|
2012-05-30 20:13:09 +02:00
|
|
|
|
|
|
|
/* core includes */
|
2016-09-15 16:08:33 +02:00
|
|
|
#include <boot_modules.h>
|
2017-12-11 13:05:23 +01:00
|
|
|
#include <core_log.h>
|
2017-02-21 13:46:59 +01:00
|
|
|
#include <hw/memory_region.h>
|
2014-04-28 21:31:57 +02:00
|
|
|
#include <map_local.h>
|
2012-05-30 20:13:09 +02:00
|
|
|
#include <platform.h>
|
2014-04-28 21:31:57 +02:00
|
|
|
#include <platform_pd.h>
|
2017-02-21 13:46:59 +01:00
|
|
|
#include <hw/page_flags.h>
|
|
|
|
#include <hw/util.h>
|
2014-04-28 21:31:57 +02:00
|
|
|
#include <pic.h>
|
|
|
|
#include <kernel/kernel.h>
|
|
|
|
#include <translation_table.h>
|
2017-03-23 03:06:53 +01:00
|
|
|
#include <kernel/cpu.h>
|
2012-05-30 20:13:09 +02:00
|
|
|
|
2016-03-03 17:57:29 +01:00
|
|
|
/* base-internal includes */
|
2016-10-06 20:07:16 +02:00
|
|
|
#include <base/internal/crt0.h>
|
2016-03-03 17:57:29 +01:00
|
|
|
#include <base/internal/stack_area.h>
|
|
|
|
|
2012-05-30 20:13:09 +02:00
|
|
|
using namespace Genode;
|
|
|
|
|
|
|
|
|
|
|
|
/**************
|
|
|
|
** Platform **
|
|
|
|
**************/
|
|
|
|
|
2019-05-16 14:20:39 +02:00
|
|
|
Hw::Boot_info<Board::Boot_info> const & Platform::_boot_info() {
|
|
|
|
return *reinterpret_cast<Hw::Boot_info<Board::Boot_info>*>(Hw::Mm::boot_info().base); }
|
2015-06-25 15:53:39 +02:00
|
|
|
|
2016-11-07 18:00:24 +01:00
|
|
|
addr_t Platform::mmio_to_virt(addr_t mmio) {
|
2017-02-21 13:46:59 +01:00
|
|
|
return _boot_info().mmio_space.virt_addr(mmio); }
|
2015-06-25 15:53:39 +02:00
|
|
|
|
2017-06-20 15:25:04 +02:00
|
|
|
addr_t Platform::core_page_table() {
|
|
|
|
return (addr_t)_boot_info().table; }
|
2012-05-30 20:13:09 +02:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
Hw::Page_table::Allocator & Platform::core_page_table_allocator()
|
|
|
|
{
|
2017-06-20 15:25:04 +02:00
|
|
|
using Allocator = Hw::Page_table::Allocator;
|
|
|
|
using Array = Allocator::Array<Hw::Page_table::CORE_TRANS_TABLE_COUNT>;
|
|
|
|
addr_t virt_addr = Hw::Mm::core_page_tables().base + sizeof(Hw::Page_table);
|
|
|
|
return *unmanaged_singleton<Array::Allocator>(_boot_info().table_allocator,
|
|
|
|
virt_addr);
|
2017-02-21 13:46:59 +01:00
|
|
|
}
|
2016-10-06 20:07:16 +02:00
|
|
|
|
|
|
|
void Platform::_init_io_mem_alloc()
|
|
|
|
{
|
|
|
|
/* add entire adress space minus the RAM memory regions */
|
|
|
|
_io_mem_alloc.add_range(0, ~0x0UL);
|
2017-02-21 13:46:59 +01:00
|
|
|
_boot_info().ram_regions.for_each([this] (Hw::Memory_region const &r) {
|
2016-10-06 20:07:16 +02:00
|
|
|
_io_mem_alloc.remove_range(r.base, r.size); });
|
|
|
|
};
|
2014-04-28 21:31:57 +02:00
|
|
|
|
2012-05-30 20:13:09 +02:00
|
|
|
|
2017-02-21 13:46:59 +01:00
|
|
|
Hw::Memory_region_array const & Platform::_core_virt_regions()
|
2016-11-07 18:00:24 +01:00
|
|
|
{
|
2017-02-21 13:46:59 +01:00
|
|
|
return *unmanaged_singleton<Hw::Memory_region_array>(
|
|
|
|
Hw::Memory_region(stack_area_virtual_base(), stack_area_virtual_size()));
|
2016-11-07 18:00:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addr_t Platform::core_phys_addr(addr_t virt)
|
|
|
|
{
|
|
|
|
addr_t ret = 0;
|
2017-02-21 13:46:59 +01:00
|
|
|
_boot_info().elf_mappings.for_each([&] (Hw::Mapping const & m)
|
2016-11-07 18:00:24 +01:00
|
|
|
{
|
|
|
|
if (virt >= m.virt() && virt < (m.virt() + m.size()))
|
|
|
|
ret = (virt - m.virt()) + m.phys();
|
|
|
|
});
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-06-20 15:25:04 +02:00
|
|
|
addr_t Platform::_rom_module_phys(addr_t virt)
|
|
|
|
{
|
|
|
|
Hw::Mapping m = _boot_info().boot_modules;
|
|
|
|
if (virt >= m.virt() && virt < (m.virt() + m.size()))
|
|
|
|
return (virt - m.virt()) + m.phys();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-17 12:51:39 +02:00
|
|
|
void Platform::_init_platform_info()
|
|
|
|
{
|
|
|
|
unsigned const pages = 1;
|
|
|
|
size_t const rom_size = pages << get_page_size_log2();
|
|
|
|
void *phys_ptr = nullptr;
|
|
|
|
void *virt_ptr = nullptr;
|
|
|
|
const char *rom_name = "platform_info";
|
|
|
|
|
|
|
|
if (!ram_alloc().alloc(get_page_size(), &phys_ptr)) {
|
|
|
|
error("could not setup platform_info ROM - ram allocation error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!region_alloc().alloc(rom_size, &virt_ptr)) {
|
|
|
|
error("could not setup platform_info ROM - region allocation error");
|
|
|
|
ram_alloc().free(phys_ptr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
|
|
|
addr_t const virt_addr = reinterpret_cast<addr_t>(virt_ptr);
|
|
|
|
|
|
|
|
if (!map_local(phys_addr, virt_addr, pages, Hw::PAGE_FLAGS_KERN_DATA)) {
|
|
|
|
error("could not setup platform_info ROM - map error");
|
|
|
|
region_alloc().free(virt_ptr);
|
|
|
|
ram_alloc().free(phys_ptr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Genode::Xml_generator xml(reinterpret_cast<char *>(virt_addr),
|
|
|
|
rom_size, rom_name, [&] ()
|
|
|
|
{
|
|
|
|
xml.node("kernel", [&] () { xml.attribute("name", "hw"); });
|
|
|
|
_init_additional_platform_info(xml);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!unmap_local(virt_addr, pages)) {
|
|
|
|
error("could not setup platform_info ROM - unmap error");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
region_alloc().free(virt_ptr);
|
|
|
|
|
|
|
|
_rom_fs.insert(
|
|
|
|
new (core_mem_alloc()) Rom_module(phys_addr, rom_size, rom_name));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-23 02:30:24 +01:00
|
|
|
Platform::Platform()
|
|
|
|
:
|
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
|
|
|
_io_mem_alloc(&core_mem_alloc()),
|
|
|
|
_io_port_alloc(&core_mem_alloc()),
|
|
|
|
_irq_alloc(&core_mem_alloc())
|
2012-05-30 20:13:09 +02:00
|
|
|
{
|
2017-03-23 03:06:53 +01:00
|
|
|
struct Kernel_resource : Exception { };
|
|
|
|
|
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_alloc.virt_alloc().add_range(Hw::Mm::core_heap().base,
|
|
|
|
Hw::Mm::core_heap().size);
|
2017-02-21 13:46:59 +01:00
|
|
|
_core_virt_regions().for_each([this] (Hw::Memory_region const & r) {
|
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_alloc.virt_alloc().remove_range(r.base, r.size); });
|
2017-02-21 13:46:59 +01:00
|
|
|
_boot_info().elf_mappings.for_each([this] (Hw::Mapping const & m) {
|
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_alloc.virt_alloc().remove_range(m.virt(), m.size()); });
|
2017-02-21 13:46:59 +01:00
|
|
|
_boot_info().ram_regions.for_each([this] (Hw::Memory_region const & region) {
|
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_alloc.phys_alloc().add_range(region.base, region.size); });
|
2016-10-06 20:07:16 +02:00
|
|
|
|
2015-03-18 23:40:58 +01:00
|
|
|
_init_io_port_alloc();
|
|
|
|
|
2015-04-03 17:22:16 +02:00
|
|
|
/* make all non-kernel interrupts available to the interrupt allocator */
|
|
|
|
for (unsigned i = 0; i < Kernel::Pic::NR_OF_IRQ; i++) {
|
2017-03-23 03:06:53 +01:00
|
|
|
bool kernel_resource = false;
|
2019-02-21 17:23:10 +01:00
|
|
|
Kernel::cpu_pool().for_each_cpu([&] (Kernel::Cpu & cpu) {
|
|
|
|
if (i == cpu.timer().interrupt_id()) {
|
2017-03-23 03:06:53 +01:00
|
|
|
kernel_resource = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (i == Pic::IPI) {
|
|
|
|
kernel_resource = true;
|
|
|
|
}
|
|
|
|
if (kernel_resource) {
|
2015-04-03 17:22:16 +02:00
|
|
|
continue;
|
2017-03-23 03:06:53 +01:00
|
|
|
}
|
2014-04-04 17:36:05 +02:00
|
|
|
_irq_alloc.add_range(i, 1);
|
2015-04-03 17:22:16 +02:00
|
|
|
}
|
2013-04-08 19:05:44 +02:00
|
|
|
|
2015-04-28 14:56:00 +02:00
|
|
|
_init_io_mem_alloc();
|
2017-08-17 16:20:56 +02:00
|
|
|
_init_rom_modules();
|
2019-04-17 12:51:39 +02:00
|
|
|
_init_platform_info();
|
2015-07-02 16:25:51 +02:00
|
|
|
|
2017-12-11 13:05:23 +01:00
|
|
|
/* core log as ROM module */
|
|
|
|
{
|
|
|
|
void * core_local_ptr = nullptr;
|
|
|
|
void * phys_ptr = nullptr;
|
|
|
|
unsigned const pages = 1;
|
|
|
|
size_t const log_size = pages << get_page_size_log2();
|
|
|
|
|
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
|
|
|
ram_alloc().alloc_aligned(log_size, &phys_ptr, get_page_size_log2());
|
2017-12-11 13:05:23 +01:00
|
|
|
addr_t const phys_addr = reinterpret_cast<addr_t>(phys_ptr);
|
|
|
|
|
|
|
|
/* let one page free after the log buffer */
|
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
|
|
|
region_alloc().alloc_aligned(log_size, &core_local_ptr, get_page_size_log2());
|
2017-12-11 13:05:23 +01:00
|
|
|
addr_t const core_local_addr = reinterpret_cast<addr_t>(core_local_ptr);
|
|
|
|
|
|
|
|
map_local(phys_addr, core_local_addr, pages);
|
|
|
|
memset(core_local_ptr, 0, log_size);
|
|
|
|
|
|
|
|
_rom_fs.insert(new (core_mem_alloc()) Rom_module(phys_addr, log_size,
|
|
|
|
"core_log"));
|
|
|
|
|
|
|
|
init_core_log(Core_log_range { core_local_addr, log_size } );
|
|
|
|
}
|
|
|
|
|
2017-12-13 19:52:06 +01:00
|
|
|
log(_rom_fs);
|
2012-05-30 20:13:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-28 21:31:57 +02:00
|
|
|
/****************************************
|
|
|
|
** Support for core memory management **
|
|
|
|
****************************************/
|
|
|
|
|
2014-07-08 15:46:53 +02:00
|
|
|
bool Genode::map_local(addr_t from_phys, addr_t to_virt, size_t num_pages,
|
|
|
|
Page_flags flags)
|
2014-04-28 21:31:57 +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
|
|
|
Platform_pd &pd = Kernel::core_pd().platform_pd();
|
|
|
|
return pd.insert_translation(to_virt, from_phys,
|
|
|
|
num_pages * get_page_size(), flags);
|
2014-04-28 21:31:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Genode::unmap_local(addr_t virt_addr, size_t num_pages)
|
|
|
|
{
|
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 &pd = Kernel::core_pd().platform_pd();
|
|
|
|
pd.flush(virt_addr, num_pages * get_page_size());
|
2015-04-28 14:07:51 +02:00
|
|
|
return true;
|
2014-04-28 21:31:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-09-17 14:16:59 +02:00
|
|
|
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
|
|
|
|
unsigned size) {
|
2015-06-16 10:59:26 +02:00
|
|
|
return ::map_local(phys_addr, virt_addr, size / get_page_size()); }
|
2014-04-28 21:31:57 +02:00
|
|
|
|
|
|
|
|
Follow practices suggested by "Effective C++"
The patch adjust the code of the base, base-<kernel>, and os repository.
To adapt existing components to fix violations of the best practices
suggested by "Effective C++" as reported by the -Weffc++ compiler
argument. The changes follow the patterns outlined below:
* A class with virtual functions can no longer publicly inherit base
classed without a vtable. The inherited object may either be moved
to a member variable, or inherited privately. The latter would be
used for classes that inherit 'List::Element' or 'Avl_node'. In order
to enable the 'List' and 'Avl_tree' to access the meta data, the
'List' must become a friend.
* Instead of adding a virtual destructor to abstract base classes,
we inherit the new 'Interface' class, which contains a virtual
destructor. This way, single-line abstract base classes can stay
as compact as they are now. The 'Interface' utility resides in
base/include/util/interface.h.
* With the new warnings enabled, all member variables must be explicitly
initialized. Basic types may be initialized with '='. All other types
are initialized with braces '{ ... }' or as class initializers. If
basic types and non-basic types appear in a row, it is nice to only
use the brace syntax (also for basic types) and align the braces.
* If a class contains pointers as members, it must now also provide a
copy constructor and assignment operator. In the most cases, one
would make them private, effectively disallowing the objects to be
copied. Unfortunately, this warning cannot be fixed be inheriting
our existing 'Noncopyable' class (the compiler fails to detect that
the inheriting class cannot be copied and still gives the error).
For now, we have to manually add declarations for both the copy
constructor and assignment operator as private class members. Those
declarations should be prepended with a comment like this:
/*
* Noncopyable
*/
Thread(Thread const &);
Thread &operator = (Thread const &);
In the future, we should revisit these places and try to replace
the pointers with references. In the presence of at least one
reference member, the compiler would no longer implicitly generate
a copy constructor. So we could remove the manual declaration.
Issue #465
2017-12-21 15:42:15 +01:00
|
|
|
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, addr_t,
|
2016-07-15 11:05:09 +02:00
|
|
|
unsigned size) {
|
2015-06-16 10:59:26 +02:00
|
|
|
return ::unmap_local(virt_addr, size / get_page_size()); }
|