2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Protection-domain facility
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2009-10-02
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2012-01-03 15:35:05 +01:00
|
|
|
* Copyright (C) 2009-2012 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
|
2012-08-01 17:04:43 +02:00
|
|
|
/*
|
|
|
|
* Must be initialized by the startup code,
|
|
|
|
* only valid in core
|
|
|
|
*/
|
|
|
|
extern Genode::addr_t __core_pd_sel;
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
namespace Genode {
|
|
|
|
|
|
|
|
class Platform_thread;
|
|
|
|
class Platform_pd
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
|
|
|
Native_capability _parent;
|
2012-08-02 12:20:00 +02:00
|
|
|
int _thread_cnt;
|
2012-07-30 11:32:06 +02:00
|
|
|
addr_t _pd_sel;
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2012-07-30 10:56:07 +02:00
|
|
|
addr_t parent_pt_sel() { return _parent.local_name(); }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Assign PD selector to PD
|
|
|
|
*/
|
2012-07-30 11:32:06 +02:00
|
|
|
void assign_pd(addr_t pd_sel) { _pd_sel = pd_sel; }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2012-08-02 12:20:00 +02:00
|
|
|
/**
|
|
|
|
* Capability selector of this task.
|
|
|
|
*
|
|
|
|
* \return PD selector
|
|
|
|
*/
|
2012-07-30 10:56:07 +02:00
|
|
|
addr_t pd_sel() { return _pd_sel; }
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2012-08-01 17:04:43 +02:00
|
|
|
/**
|
|
|
|
* Capability selector of core protection domain
|
|
|
|
*
|
|
|
|
* \return PD selector
|
|
|
|
*/
|
|
|
|
static addr_t pd_core_sel() { return __core_pd_sel; }
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _CORE__INCLUDE__PLATFORM_PD_H_ */
|