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:
@ -55,7 +55,7 @@ void BochsController::onTimerTrigger(void* thisPtr)
|
|||||||
simulator.m_LstList.triggerActiveListeners();
|
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:
|
// Check for active IOPortListeners:
|
||||||
ListenerManager::iterator it = m_LstList.begin();
|
ListenerManager::iterator it = m_LstList.begin();
|
||||||
while (it != m_LstList.end()) {
|
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);
|
IOPortListener* pIOPt = dynamic_cast<IOPortListener*>(pLi);
|
||||||
if (pIOPt != NULL && pIOPt->isMatching(port, out)) {
|
if (pIOPt != NULL && pIOPt->isMatching(port, out)) {
|
||||||
pIOPt->setData(data);
|
pIOPt->setData(data);
|
||||||
|
pIOPt->setTriggerCPU(cpu);
|
||||||
it = m_LstList.makeActive(it);
|
it = m_LstList.makeActive(it);
|
||||||
// "it" has already been set to the next element (by calling
|
// "it" has already been set to the next element (by calling
|
||||||
// makeActive()):
|
// makeActive()):
|
||||||
@ -157,4 +158,16 @@ const std::string& BochsController::getMnemonic() const
|
|||||||
return str;
|
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
|
} // end-of-namespace: fail
|
||||||
|
|||||||
@ -55,11 +55,12 @@ public:
|
|||||||
/**
|
/**
|
||||||
* I/O port communication handler. This method is called (from
|
* I/O port communication handler. This method is called (from
|
||||||
* the IOPortCom aspect) every time when Bochs performs a port I/O operation.
|
* the IOPortCom aspect) every time when Bochs performs a port I/O operation.
|
||||||
|
* @param cpu the CPU that caused the IO port access
|
||||||
* @param data the data transmitted
|
* @param data the data transmitted
|
||||||
* @param port the port it was transmitted on
|
* @param port the port it was transmitted on
|
||||||
* @param out true if the I/O traffic has been outbound, false otherwise
|
* @param out true if the I/O traffic has been outbound, false otherwise
|
||||||
*/
|
*/
|
||||||
void onIOPort(unsigned char data, unsigned port, bool out);
|
void onIOPort(ConcreteCPU* cpu, unsigned char data, unsigned port, bool out);
|
||||||
/**
|
/**
|
||||||
* Internal handler for TimerListeners. This method is called when a previously
|
* Internal handler for TimerListeners. This method is called when a previously
|
||||||
* registered (Bochs) timer triggers. It searches for the provided TimerListener
|
* registered (Bochs) timer triggers. It searches for the provided TimerListener
|
||||||
@ -144,6 +145,13 @@ public:
|
|||||||
* @param cacheEntry the Bochs internal CPU cache entry ptr
|
* @param cacheEntry the Bochs internal CPU cache entry ptr
|
||||||
*/
|
*/
|
||||||
void updateBPEventInfo(BX_CPU_C *context, bxInstruction_c *instr);
|
void updateBPEventInfo(BX_CPU_C *context, bxInstruction_c *instr);
|
||||||
|
/**
|
||||||
|
* Retrieves the concrete CPU object, based on the given Bochs' internal pointer \a pCPU.
|
||||||
|
* @param pCPU the Bochs' internal CPU object
|
||||||
|
* @return the FailBochs CPU representation that corresponds to Bochs' internal CPU \a pCPU
|
||||||
|
* @see The uses SimulatorController::getCPU().
|
||||||
|
*/
|
||||||
|
ConcreteCPU& detectCPU(BX_CPU_C* pCPU) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end-of-namespace: fail
|
} // end-of-namespace: fail
|
||||||
|
|||||||
Reference in New Issue
Block a user