genode/repos/base-foc/src/core/include/platform_pd.h
Norman Feske 511acad507 Consolidate RM service into PD session
This patch integrates three region maps into each PD session to
reduce the session overhead and to simplify the PD creation procedure.
Please refer to the issue cited below for an elaborative discussion.

Note the API change:

With this patch, the semantics of core's RM service have changed. Now,
the service is merely a tool for creating and destroying managed
dataspaces, which are rarely needed. Regular components no longer need a
RM session. For this reason, the corresponding argument for the
'Process' and 'Child' constructors has been removed.

The former interface of the 'Rm_session' is not named 'Region_map'. As a
minor refinement, the 'Fault_type' enum values are now part of the
'Region_map::State' struct.

Issue #1938
2016-05-09 13:10:51 +02:00

120 lines
2.5 KiB
C++

/*
* \brief L4/Fiasco protection domain facility
* \author Christian Helmuth
* \author Stefan Kalkowski
* \date 2006-04-11
*
* Protection domains are L4 tasks under Fiasco.OC and serve as base
* container for the platform.
*/
/*
* Copyright (C) 2006-2013 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__PLATFORM_PD_H_
#define _CORE__INCLUDE__PLATFORM_PD_H_
/* Genode includes */
#include <base/allocator_avl.h>
#include <base/exception.h>
#include <base/synced_allocator.h>
#include <platform_thread.h>
#include <base/thread.h>
/* core includes */
#include <cap_mapping.h>
#include <address_space.h>
/* base-internal includes */
#include <base/internal/stack_area.h>
/* Fiasco.OC includes */
namespace Fiasco {
#include <l4/sys/consts.h>
}
namespace Genode {
class Platform_thread;
class Platform_pd : public Address_space
{
private:
enum {
THREAD_MAX = (1 << 7),
UTCB_AREA_SIZE = (THREAD_MAX * Fiasco::L4_UTCB_OFFSET),
};
addr_t utcb_area_start()
{
return stack_area_virtual_base() +
THREAD_MAX*stack_virtual_size();
}
Cap_mapping _task;
Cap_mapping _parent;
Platform_thread *_threads[THREAD_MAX];
public:
class Threads_exhausted : Exception {};
/**
* Constructor for core.
*/
Platform_pd(Core_cap_index*);
/**
* Constructor for all tasks except core.
*/
Platform_pd(Allocator *, char const *label);
/**
* Destructor
*/
~Platform_pd();
/**
* Bind thread to protection domain
*/
void bind_thread(Platform_thread *thread);
/**
* Unbind thread from protection domain
*
* Free the thread's slot and update thread object.
*/
void unbind_thread(Platform_thread *thread);
/**
* Assign parent interface to protection domain
*/
void assign_parent(Native_capability parent);
/*******************************
** Fiasco-specific Accessors **
*******************************/
Native_capability native_task() { return _task.local; }
/*****************************
** Address-space interface **
*****************************/
/*
* On Fiasco.OC, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'region_map_support.cc'.
*/
void flush(addr_t, size_t) { PDBG("not implemented"); }
};
}
#endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */