hw: get start-thread syscall multiprocessing aware

ref #1076
This commit is contained in:
Martin Stein 2014-03-06 13:24:36 +01:00 committed by Norman Feske
parent 5f0843082a
commit ed9c4f4427

View File

@ -352,32 +352,31 @@ void Thread::_call_start_thread()
{ {
/* check permissions */ /* check permissions */
if (!_core()) { if (!_core()) {
PERR("not entitled to start thread"); PERR("permission denied");
user_arg_0(0); user_arg_0(0);
return; return;
} }
/* dispatch arguments */
unsigned const thread_id = user_arg_1();
unsigned const cpu_id = user_arg_2();
unsigned const pd_id = user_arg_3();
Native_utcb * const utcb = (Native_utcb *)user_arg_4();
/* lookup targeted thread */ /* lookup targeted thread */
Thread * const t = Thread::pool()->object(thread_id); unsigned const thread_id = user_arg_1();
if (!t) { Thread * const thread = Thread::pool()->object(thread_id);
if (!thread) {
PERR("unknown thread"); PERR("unknown thread");
user_arg_0(0); user_arg_0(0);
return; return;
} }
/* /* lookup targeted processor */
* Start thread unsigned const processor_id = user_arg_2();
* Processor * const processor = processor_pool()->select(processor_id);
* FIXME: The affinity of a thread is ignored by now. if (!processor) {
* Instead we always assign the primary processor. PERR("unknown processor");
*/ user_arg_0(0);
if (cpu_id) { PERR("multiprocessing not supported"); } return;
t->init(processor_pool()->primary(), pd_id, utcb, 1); }
user_arg_0((Call_ret)t->_pd->tlb()); /* start thread */
unsigned const pd_id = user_arg_3();
Native_utcb * const utcb = (Native_utcb *)user_arg_4();
thread->init(processor, pd_id, utcb, 1);
user_arg_0((Call_ret)thread->_pd->tlb());
} }