Extend RAM/CPU session for base-hw context-areas.

This commit is contained in:
Martin Stein 2012-05-28 16:57:09 +02:00 committed by Norman Feske
parent 2e918da325
commit 9369057f90
38 changed files with 311 additions and 43 deletions

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-service
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -52,7 +52,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, unsigned priority = 0, Platform_thread(const char *name = 0, unsigned priority = 0,
int thread_id = THREAD_INVALID); addr_t utcb = 0, int thread_id = THREAD_INVALID);
/** /**
* Destructor * Destructor

View File

@ -91,7 +91,8 @@ void Platform_thread::cancel_blocking()
} }
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id) Platform_thread::Platform_thread(const char *name, unsigned, addr_t,
int thread_id)
: _tid(-1) : _tid(-1)
{ {
strncpy(_name, name, sizeof(_name)); strncpy(_name, name, sizeof(_name));

View File

@ -10,6 +10,7 @@ SRC_CC = \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \
io_mem_session_support.cc \ io_mem_session_support.cc \

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-service
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -53,7 +53,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, unsigned priority = 0, Platform_thread(const char *name = 0, unsigned priority = 0,
int thread_id = THREAD_INVALID); addr_t utcb = 0, int thread_id = THREAD_INVALID);
/** /**
* Destructor * Destructor

View File

@ -135,7 +135,7 @@ void Platform_thread::cancel_blocking()
} }
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id) Platform_thread::Platform_thread(const char *name, unsigned, addr_t, int thread_id)
: _thread_id(thread_id), _l4_thread_id(L4_INVALID_ID), _pager(0) : _thread_id(thread_id), _l4_thread_id(L4_INVALID_ID), _pager(0)
{ {
strncpy(_name, name, sizeof(_name)); strncpy(_name, name, sizeof(_name));

View File

@ -10,6 +10,7 @@ SRC_CC = main.cc \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \
io_mem_session_support.cc \ io_mem_session_support.cc \

View File

@ -25,6 +25,14 @@ namespace Fiasco {
} }
Genode::Ram_dataspace_capability Genode::Cpu_session_component::utcb(Genode::Thread_capability thread_cap)
{
using namespace Genode;
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}
void Genode::Cpu_session_component::enable_vcpu(Genode::Thread_capability thread_cap, void Genode::Cpu_session_component::enable_vcpu(Genode::Thread_capability thread_cap,
Genode::addr_t vcpu_state) Genode::addr_t vcpu_state)
{ {

View File

@ -53,7 +53,7 @@ namespace Genode {
public: public:
Cpu_thread_component(const char *name, unsigned priority) Cpu_thread_component(const char *name, unsigned priority, addr_t)
: _platform_thread(name, priority), _bound(false) { } : _platform_thread(name, priority), _bound(false) { }
@ -80,8 +80,8 @@ namespace Genode {
Rpc_entrypoint *_thread_ep; Rpc_entrypoint *_thread_ep;
Pager_entrypoint *_pager_ep; Pager_entrypoint *_pager_ep;
Allocator_guard _md_alloc; /* guarded meta-data allocator */ Allocator_guard _md_alloc; /* guarded meta-data allocator */
Cpu_thread_allocator _slab; /* meta-data allocator */ Cpu_thread_allocator _thread_alloc; /* meta-data allocator */
Lock _slab_lock; /* protect slab access */ Lock _thread_alloc_lock; /* protect alloc access */
List<Cpu_thread_component> _thread_list; List<Cpu_thread_component> _thread_list;
Lock _thread_list_lock; /* protect thread list */ Lock _thread_list_lock; /* protect thread list */
unsigned _priority; /* priority of threads unsigned _priority; /* priority of threads
@ -127,7 +127,8 @@ namespace Genode {
** CPU session interface ** ** CPU session interface **
***************************/ ***************************/
Thread_capability create_thread(Name const &); Thread_capability create_thread(Name const &, addr_t);
Ram_dataspace_capability utcb(Thread_capability thread);
void kill_thread(Thread_capability); void kill_thread(Thread_capability);
Thread_capability first(); Thread_capability first();
Thread_capability next(Thread_capability); Thread_capability next(Thread_capability);

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-session interface
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -32,7 +32,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, unsigned priority = 0, Platform_thread(const char *name = 0, unsigned priority = 0,
int thread_id = THREAD_INVALID); addr_t utcb = 0, int thread_id = THREAD_INVALID);
/** /**
* Destructor * Destructor

View File

@ -65,7 +65,8 @@ unsigned long Platform_thread::pager_object_badge() const
} }
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id) Platform_thread::Platform_thread(const char *name, unsigned, addr_t,
int thread_id)
{ {
PWRN("not implemented"); PWRN("not implemented");
} }

View File

@ -10,6 +10,7 @@ SRC_CC = \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \
io_mem_session_support.cc \ io_mem_session_support.cc \

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-service
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -34,7 +34,7 @@ namespace Genode {
/** /**
* Constructor * Constructor
*/ */
Platform_thread(const char *name, unsigned priority); Platform_thread(const char *name, unsigned priority, addr_t);
/** /**
* Cancel currently blocking operation * Cancel currently blocking operation

View File

@ -28,7 +28,7 @@ using namespace Genode;
typedef Token<Scanner_policy_identifier_with_underline> Tid_token; typedef Token<Scanner_policy_identifier_with_underline> Tid_token;
Platform_thread::Platform_thread(const char *name, unsigned) Platform_thread::Platform_thread(const char *name, unsigned, addr_t)
{ {
/* search for thread-id portion of thread name */ /* search for thread-id portion of thread name */
Tid_token tok(name); Tid_token tok(name);

View File

@ -11,6 +11,7 @@ SRC_CC = main.cc \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \
io_port_session_component.cc \ io_port_session_component.cc \

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-service
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -41,7 +41,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, unsigned priority = 0, Platform_thread(const char *name = 0, unsigned priority = 0,
int thread_id = THREAD_INVALID); addr_t utcb = 0, int thread_id = THREAD_INVALID);
/** /**
* Destructor * Destructor

View File

@ -130,7 +130,7 @@ const
static int id_cnt; static int id_cnt;
Platform_thread::Platform_thread(const char *name, unsigned, int thread_id) Platform_thread::Platform_thread(const char *name, unsigned, addr_t, int thread_id)
: _pd(0), _id(++id_cnt) { } : _pd(0), _id(++id_cnt) { }

View File

@ -10,6 +10,7 @@ SRC_CC = \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \
io_mem_session_support.cc \ io_mem_session_support.cc \

View File

@ -0,0 +1,28 @@
/*
* \brief Platform-specific parts of cores CPU-service
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <base/printf.h>
/* Core includes */
#include <cpu_session_component.h>
using namespace Genode;
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -48,7 +48,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, Platform_thread(const char *name = 0,
unsigned priority = 0, unsigned priority = 0, addr_t utcb = 0,
int thread_id = THREAD_INVALID); int thread_id = THREAD_INVALID);
/** /**

View File

@ -178,7 +178,7 @@ unsigned long Platform_thread::pager_object_badge() const
} }
Platform_thread::Platform_thread(const char *name, unsigned prio, int thread_id) Platform_thread::Platform_thread(const char *name, unsigned prio, addr_t, int thread_id)
: _thread_id(thread_id), _l4_thread_id(L4_nilthread), _platform_pd(0), : _thread_id(thread_id), _l4_thread_id(L4_nilthread), _platform_pd(0),
_priority(prio), _pager(0) _priority(prio), _pager(0)
{ {

View File

@ -10,6 +10,7 @@ SRC_CC = main.cc \
ram_session_support.cc \ ram_session_support.cc \
rom_session_component.cc \ rom_session_component.cc \
cpu_session_component.cc \ cpu_session_component.cc \
cpu_session_support.cc \
pd_session_component.cc \ pd_session_component.cc \
okl4_pd_session_component.cc \ okl4_pd_session_component.cc \
io_mem_session_component.cc \ io_mem_session_component.cc \

View File

@ -1,4 +1,17 @@
/*
* \brief Platform-specific parts of the core CPU session interface
* \author Martin Stein
* \date 2012-04-17
*/
/*
* Copyright (C) 2009-2012 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.
*/
/* Genode includes */
#include <cpu_session_component.h> #include <cpu_session_component.h>
#include <pistachio/kip.h> #include <pistachio/kip.h>
@ -13,3 +26,9 @@ using namespace Pistachio;
// return 1; // return 1;
// } // }
Ram_dataspace_capability Cpu_session_component::utcb(Thread_capability thread_cap)
{
PERR("%s: Not implemented", __PRETTY_FUNCTION__);
return Ram_dataspace_capability();
}

View File

@ -53,7 +53,7 @@ namespace Genode {
* Constructor * Constructor
*/ */
Platform_thread(const char *name = 0, unsigned priority = 0, Platform_thread(const char *name = 0, unsigned priority = 0,
int thread_id = THREAD_INVALID); addr_t utcb = 0, int thread_id = THREAD_INVALID);
/** /**
* Destructor * Destructor

View File

@ -217,7 +217,7 @@ void Platform_thread::cancel_blocking()
} }
Platform_thread::Platform_thread(const char *name, unsigned prio, int id) Platform_thread::Platform_thread(const char *name, unsigned prio, addr_t, int id)
: _thread_id(id), _l4_thread_id(L4_nilthread), _priority(prio), _pager(0) : _thread_id(id), _l4_thread_id(L4_nilthread), _priority(prio), _pager(0)
{ {
strncpy(_name, name, sizeof(_name)); strncpy(_name, name, sizeof(_name));

View File

@ -24,8 +24,11 @@ namespace Genode {
explicit Cpu_session_client(Cpu_session_capability session) explicit Cpu_session_client(Cpu_session_capability session)
: Rpc_client<Cpu_session>(session) { } : Rpc_client<Cpu_session>(session) { }
Thread_capability create_thread(Name const &name) { Thread_capability create_thread(Name const &name, addr_t utcb = 0) {
return call<Rpc_create_thread>(name); } return call<Rpc_create_thread>(name, utcb); }
Ram_dataspace_capability utcb(Thread_capability thread) {
return call<Rpc_utcb>(thread); }
void kill_thread(Thread_capability thread) { void kill_thread(Thread_capability thread) {
call<Rpc_kill_thread>(thread); } call<Rpc_kill_thread>(thread); }

View File

@ -62,10 +62,18 @@ namespace Genode {
* Create a new thread * Create a new thread
* *
* \param name name for the thread * \param name name for the thread
* \param utcb Base of the UTCB that will be used by the thread
* \return capability representing the new thread * \return capability representing the new thread
* \throw Thread_creation_failed * \throw Thread_creation_failed
*/ */
virtual Thread_capability create_thread(Name const &name) = 0; virtual Thread_capability create_thread(Name const &name,
addr_t utcb = 0) = 0;
/**
* Get dataspace of the UTCB that is used by the specified thread
*/
virtual Ram_dataspace_capability
utcb(Thread_capability thread) = 0;
/** /**
* Kill an existing thread * Kill an existing thread
@ -188,7 +196,9 @@ namespace Genode {
*********************/ *********************/
GENODE_RPC_THROW(Rpc_create_thread, Thread_capability, create_thread, GENODE_RPC_THROW(Rpc_create_thread, Thread_capability, create_thread,
GENODE_TYPE_LIST(Thread_creation_failed), Name const &); GENODE_TYPE_LIST(Thread_creation_failed),
Name const &, addr_t);
GENODE_RPC(Rpc_utcb, Ram_dataspace_capability, utcb, Thread_capability);
GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability); GENODE_RPC(Rpc_kill_thread, void, kill_thread, Thread_capability);
GENODE_RPC(Rpc_first, Thread_capability, first,); GENODE_RPC(Rpc_first, Thread_capability, first,);
GENODE_RPC(Rpc_next, Thread_capability, next, Thread_capability); GENODE_RPC(Rpc_next, Thread_capability, next, Thread_capability);
@ -211,6 +221,7 @@ namespace Genode {
* of employing the convenience macro 'GENODE_RPC_INTERFACE'. * of employing the convenience macro 'GENODE_RPC_INTERFACE'.
*/ */
typedef Meta::Type_tuple<Rpc_create_thread, typedef Meta::Type_tuple<Rpc_create_thread,
Meta::Type_tuple<Rpc_utcb,
Meta::Type_tuple<Rpc_kill_thread, Meta::Type_tuple<Rpc_kill_thread,
Meta::Type_tuple<Rpc_first, Meta::Type_tuple<Rpc_first,
Meta::Type_tuple<Rpc_next, Meta::Type_tuple<Rpc_next,
@ -223,7 +234,7 @@ namespace Genode {
Meta::Type_tuple<Rpc_exception_handler, Meta::Type_tuple<Rpc_exception_handler,
Meta::Type_tuple<Rpc_single_step, Meta::Type_tuple<Rpc_single_step,
Meta::Empty> Meta::Empty>
> > > > > > > > > > > Rpc_functions; > > > > > > > > > > > > Rpc_functions;
}; };
} }

View File

@ -49,7 +49,8 @@ void Thread_base::start()
/* create thread at core */ /* create thread at core */
char buf[48]; char buf[48];
name(buf, sizeof(buf)); name(buf, sizeof(buf));
_thread_cap = env()->cpu_session()->create_thread(buf); Cpu_session * cpu = env()->cpu_session();
_thread_cap = cpu->create_thread(buf, (addr_t)&_context->utcb);
/* assign thread to protection domain */ /* assign thread to protection domain */
env()->pd_session()->bind_thread(_thread_cap); env()->pd_session()->bind_thread(_thread_cap);

View File

@ -24,14 +24,15 @@
using namespace Genode; using namespace Genode;
Thread_capability Cpu_session_component::create_thread(Name const &name) Thread_capability Cpu_session_component::create_thread(Name const &name, addr_t utcb)
{ {
Lock::Guard thread_list_lock_guard(_thread_list_lock); Lock::Guard thread_list_lock_guard(_thread_list_lock);
Lock::Guard slab_lock_guard(_slab_lock); Lock::Guard slab_lock_guard(_thread_alloc_lock);
Cpu_thread_component *thread = 0; Cpu_thread_component *thread = 0;
try { try {
thread = new(&_slab) Cpu_thread_component(name.string(), _priority); thread = new(&_thread_alloc) Cpu_thread_component(name.string(),
_priority, utcb);
} catch (Allocator::Out_of_memory) { } catch (Allocator::Out_of_memory) {
throw Thread_creation_failed(); throw Thread_creation_failed();
} }
@ -43,7 +44,7 @@ Thread_capability Cpu_session_component::create_thread(Name const &name)
void Cpu_session_component::_unsynchronized_kill_thread(Cpu_thread_component *thread) void Cpu_session_component::_unsynchronized_kill_thread(Cpu_thread_component *thread)
{ {
Lock::Guard lock_guard(_slab_lock); Lock::Guard lock_guard(_thread_alloc_lock);
_thread_ep->dissolve(thread); _thread_ep->dissolve(thread);
_thread_list.remove(thread); _thread_list.remove(thread);
@ -53,7 +54,7 @@ void Cpu_session_component::_unsynchronized_kill_thread(Cpu_thread_component *th
if (rc) if (rc)
rc->member_rm_session()->dissolve(rc); rc->member_rm_session()->dissolve(rc);
destroy(&_slab, thread); destroy(&_thread_alloc, thread);
} }
@ -169,7 +170,7 @@ Cpu_session_component::Cpu_session_component(Rpc_entrypoint *thread_ep,
const char *args) const char *args)
: _thread_ep(thread_ep), _pager_ep(pager_ep), : _thread_ep(thread_ep), _pager_ep(pager_ep),
_md_alloc(md_alloc, Arg_string::find_arg(args, "ram_quota").long_value(0)), _md_alloc(md_alloc, Arg_string::find_arg(args, "ram_quota").long_value(0)),
_slab(&_md_alloc), _priority(0) _thread_alloc(&_md_alloc), _priority(0)
{ {
Arg a = Arg_string::find_arg(args, "priority"); Arg a = Arg_string::find_arg(args, "priority");
if (a.valid()) { if (a.valid()) {

View File

@ -24,6 +24,7 @@
#include <ram_session/client.h> #include <ram_session/client.h>
/* core includes */ /* core includes */
#include <platform.h>
#include <core_parent.h> #include <core_parent.h>
#include <core_rm_session.h> #include <core_rm_session.h>
#include <cap_session_component.h> #include <cap_session_component.h>

View File

@ -17,13 +17,13 @@
/* Genode includes */ /* Genode includes */
#include <util/list.h> #include <util/list.h>
#include <base/allocator_guard.h> #include <base/allocator_guard.h>
#include <base/tslab.h>
#include <base/lock.h> #include <base/lock.h>
#include <base/pager.h> #include <base/pager.h>
#include <base/rpc_server.h> #include <base/rpc_server.h>
#include <cpu_session/cpu_session.h> #include <cpu_session/cpu_session.h>
/* core includes */ /* Core includes */
#include <cpu_thread_allocator.h>
#include <platform_thread.h> #include <platform_thread.h>
namespace Genode { namespace Genode {
@ -52,8 +52,9 @@ namespace Genode {
public: public:
Cpu_thread_component(const char *name, unsigned priority) Cpu_thread_component(const char *name, unsigned priority,
: _platform_thread(name, priority), _bound(false) { } addr_t utcb)
: _platform_thread(name, priority, utcb), _bound(false) { }
/************************ /************************
@ -70,17 +71,11 @@ namespace Genode {
{ {
private: private:
/**
* Allocator used for managing the CPU threads associated with the
* CPU session
*/
typedef Tslab<Cpu_thread_component, 1024> Cpu_thread_allocator;
Rpc_entrypoint *_thread_ep; Rpc_entrypoint *_thread_ep;
Pager_entrypoint *_pager_ep; Pager_entrypoint *_pager_ep;
Allocator_guard _md_alloc; /* guarded meta-data allocator */ Allocator_guard _md_alloc; /* guarded meta-data allocator */
Cpu_thread_allocator _slab; /* meta-data allocator */ Cpu_thread_allocator _thread_alloc; /* meta-data allocator */
Lock _slab_lock; /* protect slab access */ Lock _thread_alloc_lock; /* protect allocator access */
List<Cpu_thread_component> _thread_list; List<Cpu_thread_component> _thread_list;
Lock _thread_list_lock; /* protect thread list */ Lock _thread_list_lock; /* protect thread list */
unsigned _priority; /* priority of threads unsigned _priority; /* priority of threads
@ -126,7 +121,8 @@ namespace Genode {
** CPU session interface ** ** CPU session interface **
***************************/ ***************************/
Thread_capability create_thread(Name const &); Thread_capability create_thread(Name const &, addr_t utcb);
Ram_dataspace_capability utcb(Thread_capability thread);
void kill_thread(Thread_capability); void kill_thread(Thread_capability);
Thread_capability first(); Thread_capability first();
Thread_capability next(Thread_capability); Thread_capability next(Thread_capability);

View File

@ -0,0 +1,31 @@
/*
* \brief Allocator to manage CPU threads associated with a CPU session
* \author Martin Stein
* \date 2012-05-28
*/
/*
* Copyright (C) 2012 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 _BASE__SRC__CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
#define _BASE__SRC__CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_
/* Genode includes */
#include <base/tslab.h>
namespace Genode
{
class Cpu_thread_component;
/**
* Allocator to manage CPU threads associated with a CPU session
*/
typedef Tslab<Cpu_thread_component, 1024> Cpu_thread_allocator;
}
#endif /* _BASE__SRC__CORE__INCLUDE__CPU_THREAD_ALLOCATOR_H_ */

View File

@ -34,6 +34,8 @@ namespace Genode {
{ {
private: private:
class Invalid_dataspace : public Exception { };
enum { SBS = 1024 }; /* slab block size */ enum { SBS = 1024 }; /* slab block size */
typedef Tslab<Dataspace_component, SBS> Ds_slab; typedef Tslab<Dataspace_component, SBS> Ds_slab;
@ -144,6 +146,14 @@ namespace Genode {
*/ */
void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); } void upgrade_ram_quota(size_t ram_quota) { _md_alloc.upgrade(ram_quota); }
/**
* Get physical address of the RAM that backs a dataspace
*
* \param ds targeted dataspace
*
* \throw Invalid_dataspace
*/
addr_t phys_addr(Ram_dataspace_capability ds);
/*************************** /***************************
** RAM Session interface ** ** RAM Session interface **

View File

@ -24,6 +24,16 @@ using namespace Genode;
static const bool verbose = false; static const bool verbose = false;
addr_t Ram_session_component::phys_addr(Ram_dataspace_capability ds)
{
Dataspace_component * const dsc =
dynamic_cast<Dataspace_component *>(_ds_ep->obj_by_cap(ds));
if (!dsc) throw Invalid_dataspace();
return dsc->phys_addr();
}
void Ram_session_component::_free_ds(Dataspace_component *ds) void Ram_session_component::_free_ds(Dataspace_component *ds)
{ {
if (!ds) return; if (!ds) return;