genode/base-nova/src/core/include/platform_pd.h
Norman Feske 21de42c45d core: Introduce 'Address_space' interface
The new core-internal 'Address_space' interface enables cores RM service
to flush mappings of a PD in which a given 'Rm_client' thread resides.
Prior this patch, each platform invented their own way to flush mappings
in the respective 'rm_session_support.cc' implementation. However, those
implementations used to deal poorly with some corner cases. In
particular, if a PD session was destroyed prior a RM session, the RM
session would try to use no longer existing PD session. The new
'Address_space' uses the just added weak-pointer mechanism to deal with
this issue.

Furthermore, the generic 'Rm_session_component::detach' function has
been improved to avoid duplicated unmap operations for platforms that
implement the 'Address_space' interface. Therefore, it is related to
issue #595. Right now, this is OKL4 only, but other platforms will follow.
2013-03-12 21:53:08 +01:00

107 lines
2.2 KiB
C++

/*
* \brief Protection-domain facility
* \author Norman Feske
* \date 2009-10-02
*/
/*
* Copyright (C) 2009-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_
#include <platform_thread.h>
#include <address_space.h>
/*
* Must be initialized by the startup code,
* only valid in core
*/
extern Genode::addr_t __core_pd_sel;
namespace Genode {
class Platform_thread;
class Platform_pd : public Address_space
{
private:
Native_capability _parent;
int _thread_cnt;
addr_t _pd_sel;
public:
/**
* Constructors
*/
Platform_pd(signed pd_id = -1, bool create = true);
/**
* Destructor
*/
~Platform_pd();
/**
* Bind thread to protection domain
*
* \return 0 on success or
* -1 if thread ID allocation failed.
*/
int 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
*/
int assign_parent(Native_capability parent);
/**
* Return portal capability selector for parent interface
*/
addr_t parent_pt_sel() { return _parent.local_name(); }
/**
* Assign PD selector to PD
*/
void assign_pd(addr_t pd_sel) { _pd_sel = pd_sel; }
/**
* Capability selector of this task.
*
* \return PD selector
*/
addr_t pd_sel() { return _pd_sel; }
/**
* Capability selector of core protection domain
*
* \return PD selector
*/
static addr_t pd_core_sel() { return __core_pd_sel; }
/*****************************
** Address-space interface **
*****************************/
/*
* On NOVA, we don't use directed unmap but rely on the
* in-kernel mapping database. See 'rm_session_support.cc'.
*/
void flush(addr_t, size_t) { PDBG("not implemented"); }
};
}
#endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */