mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 20:05:54 +00:00
parent
49bf33e404
commit
a586828844
@ -120,6 +120,11 @@ namespace Genode {
|
||||
while (1) ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Affinity::Space affinity_space() const
|
||||
{
|
||||
return Affinity::Space(PROCESSORS);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,8 @@ namespace Genode {
|
||||
*/
|
||||
bool _main_thread;
|
||||
|
||||
Affinity::Location _location;
|
||||
|
||||
/**
|
||||
* Common construction part
|
||||
*/
|
||||
@ -116,11 +118,10 @@ namespace Genode {
|
||||
/**
|
||||
* Run this thread
|
||||
*
|
||||
* \param ip initial instruction pointer
|
||||
* \param sp initial stack pointer
|
||||
* \param cpu_id kernel name of targeted CPU
|
||||
* \param ip initial instruction pointer
|
||||
* \param sp initial stack pointer
|
||||
*/
|
||||
int start(void * const ip, void * const sp, unsigned const cpu_id = 0);
|
||||
int start(void * const ip, void * const sp);
|
||||
|
||||
/**
|
||||
* Pause this thread
|
||||
@ -154,13 +155,15 @@ namespace Genode {
|
||||
|
||||
/**
|
||||
* Set the executing CPU for this thread
|
||||
*
|
||||
* \param location targeted location in affinity space
|
||||
*/
|
||||
void affinity(Affinity::Location) { }
|
||||
void affinity(Affinity::Location const & location);
|
||||
|
||||
/**
|
||||
* Get the executing CPU for this thread
|
||||
*/
|
||||
Affinity::Location affinity() { return Affinity::Location(); };
|
||||
Affinity::Location affinity() const;
|
||||
|
||||
/**
|
||||
* Return the address space to which the thread is bound
|
||||
|
@ -160,8 +160,16 @@ int Platform_thread::join_pd(unsigned const pd_id, bool const main_thread,
|
||||
}
|
||||
|
||||
|
||||
int Platform_thread::start(void * const ip, void * const sp,
|
||||
unsigned int const cpu_id)
|
||||
void Platform_thread::affinity(Affinity::Location const & location)
|
||||
{
|
||||
_location = location;
|
||||
}
|
||||
|
||||
|
||||
Affinity::Location Platform_thread::affinity() const { return _location; }
|
||||
|
||||
|
||||
int Platform_thread::start(void * const ip, void * const sp)
|
||||
{
|
||||
/* attach UTCB in case of a main thread */
|
||||
if (_main_thread) {
|
||||
@ -188,9 +196,14 @@ int Platform_thread::start(void * const ip, void * const sp,
|
||||
PERR("failed to initialize thread registers");
|
||||
return -1;
|
||||
}
|
||||
/* determine kernel name of targeted processor */
|
||||
unsigned processor_id;
|
||||
if (_location.valid()) { processor_id = _location.xpos(); }
|
||||
else { processor_id = Processor_driver::primary_id(); }
|
||||
|
||||
/* start executing new thread */
|
||||
_utcb_phys->start_info()->init(_id, _utcb);
|
||||
_tlb = Kernel::start_thread(_id, cpu_id, _pd_id, _utcb_phys);
|
||||
_tlb = Kernel::start_thread(_id, processor_id, _pd_id, _utcb_phys);
|
||||
if (!_tlb) {
|
||||
PERR("failed to start thread");
|
||||
return -1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user