base: hand over Pd_connection label to Platform_pd

fix: #656
This commit is contained in:
Martin Stein 2013-02-21 16:52:12 +01:00 committed by Norman Feske
parent 8bc14eb75a
commit ea7ed5947a
15 changed files with 59 additions and 15 deletions

View File

@ -42,7 +42,7 @@ namespace Genode {
* Constructors * Constructors
*/ */
Platform_pd(bool core); Platform_pd(bool core);
Platform_pd(signed pd_id = -1, bool create = true); Platform_pd(char const *, signed pd_id = -1, bool create = true);
/** /**
* Destructor * Destructor

View File

@ -98,7 +98,8 @@ Platform_pd::Platform_pd(bool core)
} }
Platform_pd::Platform_pd(signed pd_id, bool create) : _space_id(TASK_ID_INVALID) Platform_pd::Platform_pd(char const *, signed pd_id, bool create)
: _space_id(TASK_ID_INVALID)
{ {
_space_id = TASK_ID_INVALID; _space_id = TASK_ID_INVALID;

View File

@ -35,6 +35,7 @@ namespace Genode {
*/ */
typedef Synchronized_range_allocator<Allocator_avl> Phys_allocator; typedef Synchronized_range_allocator<Allocator_avl> Phys_allocator;
char _core_label[1]; /* to satisfy _core_pd */
Platform_pd *_core_pd; /* core protection domain object */ Platform_pd *_core_pd; /* core protection domain object */
Phys_allocator _ram_alloc; /* RAM allocator */ Phys_allocator _ram_alloc; /* RAM allocator */
Phys_allocator _io_mem_alloc; /* MMIO allocator */ Phys_allocator _io_mem_alloc; /* MMIO allocator */

View File

@ -142,7 +142,8 @@ namespace Genode {
/** /**
* Constructor * Constructor
*/ */
Platform_pd(signed pd_id = PD_INVALID, bool create = true); Platform_pd(char const *, signed pd_id = PD_INVALID,
bool create = true);
/** /**
* Destructor * Destructor

View File

@ -489,7 +489,8 @@ Platform::Platform() :
Platform_pd::init(); Platform_pd::init();
/* setup pd object for core pd */ /* setup pd object for core pd */
_core_pd = new(core_mem_alloc()) Platform_pd(myself.id.task, false); _core_label[0] = 0;
_core_pd = new(core_mem_alloc()) Platform_pd(_core_label, myself.id.task, false);
/* /*
* We setup the thread object for thread0 in core pd using a special * We setup the thread object for thread0 in core pd using a special

View File

@ -236,7 +236,7 @@ void Platform_pd::unbind_thread(Platform_thread *thread)
} }
Platform_pd::Platform_pd(signed pd_id, bool create) Platform_pd::Platform_pd(char const *, signed pd_id, bool create)
{ {
/* check correct init */ /* check correct init */
if (!_init) if (!_init)

View File

@ -27,7 +27,7 @@ namespace Genode {
* Constructors * Constructors
*/ */
Platform_pd(bool core); Platform_pd(bool core);
Platform_pd(signed pd_id = -1, bool create = true); Platform_pd(char const *, signed pd_id = -1, bool create = true);
/** /**
* Destructor * Destructor

View File

@ -43,7 +43,7 @@ Platform_pd::Platform_pd(bool core)
} }
Platform_pd::Platform_pd(signed pd_id, bool create) Platform_pd::Platform_pd(char const *, signed pd_id, bool create)
{ {
PWRN("not yet implemented"); PWRN("not yet implemented");
} }

View File

@ -41,13 +41,14 @@ namespace Genode
Native_capability _parent; /* our parent interface */ Native_capability _parent; /* our parent interface */
Native_thread_id _main_thread; /* the first thread that gets Native_thread_id _main_thread; /* the first thread that gets
* executed in this PD */ * executed in this PD */
char const * _label; /* PD-connection label */
public: public:
/** /**
* Constructor * Constructor
*/ */
Platform_pd() : _main_thread(0) Platform_pd(char const *label) : _main_thread(0), _label(label)
{ {
/* get some aligned space for the kernel object */ /* get some aligned space for the kernel object */
void * kernel_pd; void * kernel_pd;

View File

@ -16,6 +16,7 @@
/* Genode includes */ /* Genode includes */
#include <base/rpc_server.h> #include <base/rpc_server.h>
#include <util/arg_string.h>
#include <pd_session/pd_session.h> #include <pd_session/pd_session.h>
/* core includes */ /* core includes */
@ -27,6 +28,24 @@ namespace Genode {
{ {
private: private:
/**
* Read and store the PD label
*/
struct Label {
enum { MAX_LEN = 64 };
char string[MAX_LEN];
/**
* Constructor
*/
Label(char const *args)
{
Arg_string::find_arg(args, "label").string(string, sizeof(string), "");
}
} const _label;
Platform_pd _pd; Platform_pd _pd;
Parent_capability _parent; Parent_capability _parent;
Rpc_entrypoint *_thread_ep; Rpc_entrypoint *_thread_ep;
@ -34,7 +53,7 @@ namespace Genode {
public: public:
Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) Pd_session_component(Rpc_entrypoint *thread_ep, const char *args)
: _thread_ep(thread_ep) { } : _label(args), _pd(_label.string), _thread_ep(thread_ep) { }
/**************************/ /**************************/

View File

@ -39,7 +39,7 @@ namespace Genode {
/** /**
* Constructors * Constructors
*/ */
Platform_pd(signed pd_id = -1, bool create = true); Platform_pd(char const *, signed pd_id = -1, bool create = true);
/** /**
* Destructor * Destructor

View File

@ -47,7 +47,7 @@ int Platform_pd::assign_parent(Native_capability parent)
} }
Platform_pd::Platform_pd(signed pd_id, bool create) Platform_pd::Platform_pd(char const *, signed pd_id, bool create)
: _thread_cnt(0), _pd_sel(~0UL) { } : _thread_cnt(0), _pd_sel(~0UL) { }

View File

@ -183,7 +183,8 @@ namespace Genode {
* Constructors * Constructors
*/ */
Platform_pd(bool core); Platform_pd(bool core);
Platform_pd(signed pd_id = PD_INVALID, bool create = true); Platform_pd(char const *, signed pd_id = PD_INVALID,
bool create = true);
/** /**
* Destructor * Destructor

View File

@ -340,7 +340,7 @@ Platform_pd::Platform_pd(bool core) :
} }
Platform_pd::Platform_pd(signed pd_id, bool create) Platform_pd::Platform_pd(char const *, signed pd_id, bool create)
{ {
if (!create) if (!create)
panic("create must be true."); panic("create must be true.");

View File

@ -17,6 +17,7 @@
/* Genode includes */ /* Genode includes */
#include <base/rpc_server.h> #include <base/rpc_server.h>
#include <pd_session/pd_session.h> #include <pd_session/pd_session.h>
#include <util/arg_string.h>
/* core includes */ /* core includes */
#include <platform_pd.h> #include <platform_pd.h>
@ -27,14 +28,32 @@ namespace Genode {
{ {
private: private:
/**
* Read and store the PD label
*/
struct Label {
enum { MAX_LEN = 64 };
char string[MAX_LEN];
/**
* Constructor
*/
Label(char const *args)
{
Arg_string::find_arg(args, "label").string(string, sizeof(string), "");
}
} const _label;
Platform_pd _pd; Platform_pd _pd;
Parent_capability _parent; Parent_capability _parent;
Rpc_entrypoint *_thread_ep; Rpc_entrypoint *_thread_ep;
public: public:
Pd_session_component(Rpc_entrypoint *thread_ep, const char *args) Pd_session_component(Rpc_entrypoint *thread_ep, char const *args)
: _thread_ep(thread_ep) { } : _label(args), _pd(_label.string), _thread_ep(thread_ep) { }
/**************************/ /**************************/