hw: provide identification of a processor object

ref #1076
This commit is contained in:
Martin Stein 2014-03-06 13:55:56 +01:00 committed by Norman Feske
parent e38060d81e
commit f545fa0e36
10 changed files with 23 additions and 12 deletions

View File

@ -29,7 +29,10 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return Mpidr::Aff_0::get(Mpidr::read()); } static unsigned executing_id()
{
return Mpidr::Aff_0::get(Mpidr::read());
}
/** /**
* Return kernel name of the primary processor * Return kernel name of the primary processor

View File

@ -34,7 +34,7 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return primary_id(); } static unsigned executing_id() { return primary_id(); }
}; };
} }

View File

@ -22,4 +22,4 @@ namespace Kernel { Pic * pic(); }
void Irq::_disable() const { pic()->mask(_id()); } void Irq::_disable() const { pic()->mask(_id()); }
void Irq::_enable() const { pic()->unmask(_id(), Processor::id()); } void Irq::_enable() const { pic()->unmask(_id(), Processor::executing_id()); }

View File

@ -236,7 +236,7 @@ extern "C" void init_kernel_multiprocessor()
/* initialize interrupt controller */ /* initialize interrupt controller */
pic()->init_processor_local(); pic()->init_processor_local();
unsigned const processor_id = Processor::id(); unsigned const processor_id = Processor::executing_id();
pic()->unmask(Timer::interrupt_id(processor_id), processor_id); pic()->unmask(Timer::interrupt_id(processor_id), processor_id);
/* as primary processor create the core main thread */ /* as primary processor create the core main thread */
@ -278,7 +278,7 @@ extern "C" void init_kernel_multiprocessor()
extern "C" void kernel() extern "C" void kernel()
{ {
data_lock().lock(); data_lock().lock();
unsigned const processor_id = Processor::id(); unsigned const processor_id = Processor::executing_id();
Processor * const processor = processor_pool()->select(processor_id); Processor * const processor = processor_pool()->select(processor_id);
Processor_scheduler * const scheduler = processor->scheduler(); Processor_scheduler * const scheduler = processor->scheduler();
scheduler->head()->exception(processor_id); scheduler->head()->exception(processor_id);

View File

@ -92,6 +92,7 @@ class Kernel::Processor : public Processor_driver
{ {
private: private:
unsigned const _id;
Idle_thread _idle; Idle_thread _idle;
Processor_scheduler _scheduler; Processor_scheduler _scheduler;
@ -99,14 +100,21 @@ class Kernel::Processor : public Processor_driver
/** /**
* Constructor * Constructor
*
* \param id kernel name of the processor object
*/ */
Processor() : _idle(this), _scheduler(&_idle) { } Processor(unsigned const id)
:
_id(id), _idle(this), _scheduler(&_idle)
{ }
/*************** /***************
** Accessors ** ** Accessors **
***************/ ***************/
unsigned id() const { return _id; }
Processor_scheduler * scheduler() { return &_scheduler; } Processor_scheduler * scheduler() { return &_scheduler; }
}; };
@ -126,7 +134,7 @@ class Kernel::Processor_pool
Processor_pool() Processor_pool()
{ {
for (unsigned i = 0; i < PROCESSORS; i++) { for (unsigned i = 0; i < PROCESSORS; i++) {
new (_data[i]) Processor; new (_data[i]) Processor(i);
} }
} }

View File

@ -29,7 +29,7 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return 0; } static unsigned executing_id() { return 0; }
/** /**
* Return kernel name of the primary processor * Return kernel name of the primary processor

View File

@ -34,7 +34,7 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return primary_id(); } static unsigned executing_id() { return primary_id(); }
}; };
} }

View File

@ -34,7 +34,7 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return primary_id(); } static unsigned executing_id() { return primary_id(); }
}; };
} }

View File

@ -212,7 +212,7 @@ namespace Arm_v6
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return primary_id(); } static unsigned executing_id() { return primary_id(); }
}; };
} }

View File

@ -34,7 +34,7 @@ namespace Genode
/** /**
* Return kernel name of the executing processor * Return kernel name of the executing processor
*/ */
static unsigned id() { return primary_id(); } static unsigned executing_id() { return primary_id(); }
}; };
} }