safeguard the synchronized allocator template

* Move the Synced_interface from os -> base
* Align the naming of "synchronized" helpers to "Synced_*"
* Move Synced_range_allocator to core's private headers
* Remove the raw() and lock() members from Synced_allocator and
  Synced_range_allocator, and re-use the Synced_interface for them
* Make core's Mapped_mem_allocator a friend class of Synced_range_allocator
  to enable the needed "unsafe" access of its physical and virtual allocators

Fix #1697
This commit is contained in:
Stefan Kalkowski
2015-09-17 14:16:59 +02:00
committed by Christian Helmuth
parent 53eb666ed0
commit ccb968ff7d
35 changed files with 432 additions and 519 deletions

View File

@ -16,7 +16,7 @@
#define _CORE__INCLUDE__PLATFORM_H_
/* Genode includes */
#include <base/sync_allocator.h>
#include <base/synced_allocator.h>
#include <base/allocator_avl.h>
#include <irq_session/irq_session.h>
@ -46,8 +46,6 @@ namespace Genode {
{
private:
typedef Core_mem_allocator::Phys_allocator Phys_allocator;
Core_mem_allocator _core_mem_alloc; /* core-accessible memory */
Phys_allocator _io_mem_alloc; /* MMIO allocator */
Phys_allocator _io_port_alloc; /* I/O port allocator */

View File

@ -59,7 +59,7 @@ class Hw::Address_space : public Genode::Address_space
private:
friend class Genode::Platform;
friend class Genode::Core_mem_allocator::Mapped_mem_allocator;
friend class Genode::Mapped_mem_allocator;
using Table_allocator =
Translation_table_allocator_tpl<DEFAULT_TRANSLATION_TABLE_MAX>;

View File

@ -159,23 +159,23 @@ Platform::Platform()
if (VERBOSE) {
printf("Core virtual memory allocator\n");
printf("---------------------\n");
_core_mem_alloc.virt_alloc()->raw()->dump_addr_tree();
(*_core_mem_alloc.virt_alloc())()->dump_addr_tree();
printf("\n");
printf("RAM memory allocator\n");
printf("---------------------\n");
_core_mem_alloc.phys_alloc()->raw()->dump_addr_tree();
(*_core_mem_alloc.phys_alloc())()->dump_addr_tree();
printf("\n");
printf("IO memory allocator\n");
printf("-------------------\n");
_io_mem_alloc.raw()->dump_addr_tree();
_io_mem_alloc()->dump_addr_tree();
printf("\n");
printf("IO port allocator\n");
printf("-------------------\n");
_io_port_alloc.raw()->dump_addr_tree();
_io_port_alloc()->dump_addr_tree();
printf("\n");
printf("IRQ allocator\n");
printf("-------------------\n");
_irq_alloc.raw()->dump_addr_tree();
_irq_alloc()->dump_addr_tree();
printf("\n");
printf("ROM filesystem\n");
printf("--------------\n");
@ -217,12 +217,10 @@ bool Genode::unmap_local(addr_t virt_addr, size_t num_pages)
}
bool Core_mem_allocator::Mapped_mem_allocator::_map_local(addr_t virt_addr,
addr_t phys_addr,
unsigned size) {
bool Mapped_mem_allocator::_map_local(addr_t virt_addr, addr_t phys_addr,
unsigned size) {
return ::map_local(phys_addr, virt_addr, size / get_page_size()); }
bool Core_mem_allocator::Mapped_mem_allocator::_unmap_local(addr_t virt_addr,
unsigned size) {
bool Mapped_mem_allocator::_unmap_local(addr_t virt_addr, unsigned size) {
return ::unmap_local(virt_addr, size / get_page_size()); }