onIOPort needs to have a ConcreteCPU argument as well; detectCPU() added

detectCPU() allows us to easily retrieve the current Fail-CPU object which is a regular use case in the aspect headers, now. (Another solution would be a slice in the Bochs CPU class which inserts a reference to the Fail CPU object. Maybe we 'll implement this at a later point.)

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2006 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2013-01-17 13:41:07 +00:00
parent d3cf2359a4
commit 214bb36b47
2 changed files with 23 additions and 2 deletions

View File

@ -55,7 +55,7 @@ void BochsController::onTimerTrigger(void* thisPtr)
simulator.m_LstList.triggerActiveListeners();
}
void BochsController::onIOPort(unsigned char data, unsigned port, bool out) {
void BochsController::onIOPort(ConcreteCPU* cpu, unsigned char data, unsigned port, bool out) {
// Check for active IOPortListeners:
ListenerManager::iterator it = m_LstList.begin();
while (it != m_LstList.end()) {
@ -63,6 +63,7 @@ void BochsController::onIOPort(unsigned char data, unsigned port, bool out) {
IOPortListener* pIOPt = dynamic_cast<IOPortListener*>(pLi);
if (pIOPt != NULL && pIOPt->isMatching(port, out)) {
pIOPt->setData(data);
pIOPt->setTriggerCPU(cpu);
it = m_LstList.makeActive(it);
// "it" has already been set to the next element (by calling
// makeActive()):
@ -157,4 +158,16 @@ const std::string& BochsController::getMnemonic() const
return str;
}
ConcreteCPU& BochsController::detectCPU(BX_CPU_C* pCPU) const
{
unsigned i = 0;
#if BX_SUPPORT_SMP
for (; i < BX_SMP_PROCESSORS; i++) {
if (BX_CPU_C[i] == pCPU) // cmp this ptr with all possible CPU objects
break; // index "i" found! -> stop!
}
#endif
return getCPU(i);
}
} // end-of-namespace: fail