hw: don't provide thread base via platform thread

ref #953
This commit is contained in:
Martin Stein 2013-11-18 16:22:55 +01:00 committed by Norman Feske
parent 99c649c42f
commit 84e05e0653
3 changed files with 10 additions and 28 deletions

View File

@ -31,7 +31,6 @@ namespace Genode {
class Pager_object;
class Thread_state;
class Thread_base;
class Rm_client;
class Platform_thread;
@ -42,7 +41,6 @@ namespace Genode {
{
enum { LABEL_MAX_LEN = 32 };
Thread_base * _thread_base;
size_t _stack_size;
unsigned _pd_id;
Weak_ptr<Address_space> _address_space;
@ -80,14 +78,12 @@ namespace Genode {
/**
* Constructor for core threads
*
* \param label debugging label
* \param thread_base Genode thread object
* \param stack_size initial size of the stack
* \param pd_id kernel name of targeted protection domain
* \param label debugging label
* \param stack_size initial size of the stack
* \param pd_id kernel name of targeted protection domain
*/
Platform_thread(const char * const label,
Thread_base * const thread_base,
size_t const stack_size, unsigned const pd_id);
Platform_thread(const char * const label, size_t const stack_size,
unsigned const pd_id);
/**
* Constructor for threads outside of core
@ -186,14 +182,6 @@ namespace Genode {
size_t stack_size() const { return _stack_size; }
Thread_base * thread_base()
{
if (!_thread_base && !_main_thread) {
PERR("invalid thread base");
}
return _thread_base;
}
Native_utcb * utcb_phys() const { return _utcb_phys; }
Ram_dataspace_capability utcb() const { return _utcb; }

View File

@ -74,10 +74,9 @@ Platform_thread::~Platform_thread()
Platform_thread::Platform_thread(const char * const label,
Thread_base * const thread_base,
size_t const stack_size, unsigned const pd_id)
size_t const stack_size,
unsigned const pd_id)
:
_thread_base(thread_base),
_stack_size(stack_size),
_pd_id(pd_id),
_rm_client(0),
@ -109,7 +108,6 @@ Platform_thread::Platform_thread(const char * const label,
unsigned const priority,
addr_t const utcb)
:
_thread_base(0),
_stack_size(0),
_pd_id(0),
_rm_client(0),

View File

@ -44,11 +44,7 @@ Thread_base * Thread_base::myself()
addr_t sp = (addr_t)(&dummy);
enum { SP_MASK = ~((1 << CORE_STACK_ALIGNM_LOG2) - 1) };
Core_thread_id id = *(Core_thread_id *)((addr_t)sp & SP_MASK);
/* if the ident is zero this is the main thread */
Platform_thread * const pt = (Platform_thread *)id;
if (pt) { return pt->thread_base(); }
return 0;
return (Thread_base *)id;
}
@ -64,7 +60,7 @@ Thread_base::Thread_base(const char *name, size_t stack_size)
: _list_element(this)
{
_tid.pt = new (platform()->core_mem_alloc())
Platform_thread(name, this, stack_size, Kernel::core_id());
Platform_thread(name, stack_size, Kernel::core_id());
}
@ -91,7 +87,7 @@ void Thread_base::start()
return;
}
/* provide thread ident at the aligned base of the stack */
*(Core_thread_id *)base = (Core_thread_id)_tid.pt;
*(Core_thread_id *)base = (Core_thread_id)this;
/* start thread with stack pointer at the top of stack */
void * sp = (void *)((addr_t)base + size);