mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 10:46:25 +00:00
parent
a586828844
commit
395e955756
@ -64,6 +64,11 @@ namespace Genode
|
|||||||
*/
|
*/
|
||||||
class Start_info;
|
class Start_info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Info that a core-thread creator hands out to Platform_thread::start
|
||||||
|
*/
|
||||||
|
class Core_start_info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory region that is exclusive to every thread and known by the kernel
|
* Memory region that is exclusive to every thread and known by the kernel
|
||||||
*/
|
*/
|
||||||
@ -260,6 +265,32 @@ class Genode::Start_info
|
|||||||
Native_capability utcb_ds() const { return _utcb_ds; }
|
Native_capability utcb_ds() const { return _utcb_ds; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class Genode::Core_start_info
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
unsigned _processor_id;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set-up valid core startup-message
|
||||||
|
*
|
||||||
|
* \param processor_id kernel name of the processor to start on
|
||||||
|
*/
|
||||||
|
void init(unsigned const processor_id)
|
||||||
|
{
|
||||||
|
_processor_id = processor_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************
|
||||||
|
** Accessors **
|
||||||
|
***************/
|
||||||
|
|
||||||
|
unsigned processor_id() const { return _processor_id; }
|
||||||
|
};
|
||||||
|
|
||||||
class Genode::Native_utcb
|
class Genode::Native_utcb
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -279,6 +310,11 @@ class Genode::Native_utcb
|
|||||||
|
|
||||||
Start_info * start_info() const { return (Start_info *)_data; }
|
Start_info * start_info() const { return (Start_info *)_data; }
|
||||||
|
|
||||||
|
Core_start_info * core_start_info() const
|
||||||
|
{
|
||||||
|
return (Core_start_info *)_data;
|
||||||
|
}
|
||||||
|
|
||||||
size_t size() const { return sizeof(_data)/sizeof(_data[0]); }
|
size_t size() const { return sizeof(_data)/sizeof(_data[0]); }
|
||||||
|
|
||||||
void * base() const { return (void *)_data; }
|
void * base() const { return (void *)_data; }
|
||||||
|
@ -97,6 +97,9 @@ Platform_thread::Platform_thread(size_t const stack_size,
|
|||||||
}
|
}
|
||||||
_utcb_virt = _utcb_phys;
|
_utcb_virt = _utcb_phys;
|
||||||
|
|
||||||
|
/* set-up default start-info */
|
||||||
|
_utcb_virt->core_start_info()->init(Processor_driver::primary_id());
|
||||||
|
|
||||||
/* create kernel object */
|
/* create kernel object */
|
||||||
_id = Kernel::new_thread(_kernel_thread, Kernel::Priority::MAX, _label);
|
_id = Kernel::new_thread(_kernel_thread, Kernel::Priority::MAX, _label);
|
||||||
if (!_id) {
|
if (!_id) {
|
||||||
|
@ -85,10 +85,16 @@ void Thread_base::start()
|
|||||||
/* provide thread ident at the aligned base of the stack */
|
/* provide thread ident at the aligned base of the stack */
|
||||||
*(Core_thread_id *)base = (Core_thread_id)this;
|
*(Core_thread_id *)base = (Core_thread_id)this;
|
||||||
|
|
||||||
|
/* set affinity of thread */
|
||||||
|
Platform_thread * const platform_thread = _tid.platform_thread;
|
||||||
|
unsigned const processor_id = utcb()->core_start_info()->processor_id();
|
||||||
|
Affinity::Location location(processor_id, 0, 1, 1);
|
||||||
|
platform_thread->affinity(location);
|
||||||
|
|
||||||
/* start thread with stack pointer at the top of stack */
|
/* start thread with stack pointer at the top of stack */
|
||||||
void * sp = (void *)((addr_t)base + size);
|
void * sp = (void *)((addr_t)base + size);
|
||||||
void * ip = (void *)&_thread_start;
|
void * ip = (void *)&_thread_start;
|
||||||
if (_tid.platform_thread->start(ip, sp)) {
|
if (platform_thread->start(ip, sp)) {
|
||||||
PERR("failed to start thread");
|
PERR("failed to start thread");
|
||||||
alloc->free(base, size);
|
alloc->free(base, size);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user