git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2005 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
#include "CPUState.hpp"
|
|
|
|
namespace fail {
|
|
|
|
int interrupt_to_fire = -1;
|
|
|
|
bool CPUState::isSuppressedInterrupt(unsigned interruptNum)
|
|
{
|
|
for (size_t i = 0; i < m_SuppressedInterrupts.size(); i++)
|
|
if ((m_SuppressedInterrupts[i] == interruptNum ||
|
|
m_SuppressedInterrupts[i] == ANY_INTERRUPT) &&
|
|
interruptNum != (unsigned)interrupt_to_fire + 32) {
|
|
// FIXME: This should be dead code...(?)
|
|
if ((int)interruptNum == interrupt_to_fire + 32) {
|
|
interrupt_to_fire = -1;
|
|
return true;
|
|
}
|
|
return true;
|
|
}
|
|
// FIXME: This is simulator-(x86)-specific stuff... (?)
|
|
return false;
|
|
}
|
|
|
|
bool CPUState::addSuppressedInterrupt(unsigned interruptNum)
|
|
{
|
|
// Check if already existing:
|
|
if (isSuppressedInterrupt(interruptNum+32))
|
|
return false; // already added: nothing to do here
|
|
|
|
// FIXME: addSuppressedInterrupt(ANY_INTERRUPT) can still be called more
|
|
// than once. This is not handled by the if-statement above.
|
|
if (interruptNum == ANY_INTERRUPT)
|
|
m_SuppressedInterrupts.push_back(interruptNum);
|
|
else
|
|
m_SuppressedInterrupts.push_back(interruptNum+32);
|
|
return true;
|
|
}
|
|
|
|
bool CPUState::removeSuppressedInterrupt(unsigned interruptNum)
|
|
{
|
|
for (size_t i = 0; i < m_SuppressedInterrupts.size(); i++) {
|
|
if (m_SuppressedInterrupts[i] == interruptNum+32 ||
|
|
m_SuppressedInterrupts[i] == ANY_INTERRUPT)
|
|
m_SuppressedInterrupts.erase(m_SuppressedInterrupts.begin() + i);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
} // end-of-namespace: fail
|