bugfix: Add BochsListener to CMakeLists, workaround for onTimerTrigger
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1717 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -7,6 +7,7 @@ if(BUILD_BOCHS)
|
|||||||
SimulatorController.cc
|
SimulatorController.cc
|
||||||
perf/BreakpointBuffer.cc
|
perf/BreakpointBuffer.cc
|
||||||
bochs/BochsController.cc
|
bochs/BochsController.cc
|
||||||
|
bochs/BochsListener.cc
|
||||||
)
|
)
|
||||||
elseif(BUILD_GEM5)
|
elseif(BUILD_GEM5)
|
||||||
set(SRCS
|
set(SRCS
|
||||||
|
|||||||
@ -125,6 +125,22 @@ void BochsController::updateBPEventInfo(BX_CPU_C *context, bxInstruction_c *inst
|
|||||||
m_CurrentInstruction = instr;
|
m_CurrentInstruction = instr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BochsController::onTimerTrigger(void* thisPtr)
|
||||||
|
{
|
||||||
|
// FIXME: The timer logic can be modified to use only one timer in Bochs.
|
||||||
|
// (For now, this suffices.)
|
||||||
|
TimerListener* pli = static_cast<TimerListener*>(thisPtr);
|
||||||
|
// Check for a matching TimerListener. (In fact, we are only
|
||||||
|
// interessted in the iterator pointing at pli.)
|
||||||
|
ListenerManager::iterator it = std::find(simulator.m_LstList.begin(),
|
||||||
|
simulator.m_LstList.end(), pli);
|
||||||
|
// TODO: This has O(|m_LstList|) time complexity. We can further improve this
|
||||||
|
// by creating a method such that makeActive(pli) works as well,
|
||||||
|
// reducing the time complexity to O(1).
|
||||||
|
simulator.m_LstList.makeActive(it);
|
||||||
|
simulator.m_LstList.triggerActiveListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void BochsController::onIOPort(unsigned char data, unsigned port, bool out) {
|
void BochsController::onIOPort(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();
|
||||||
|
|||||||
@ -64,6 +64,23 @@ public:
|
|||||||
* @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(unsigned char data, unsigned port, bool out);
|
||||||
|
/**
|
||||||
|
* Internal handler for TimerListeners. This method is called when a previously
|
||||||
|
* registered (Bochs) timer triggers. It searches for the provided TimerListener
|
||||||
|
* object within the ListenerManager and fires such an event by calling
|
||||||
|
* \c triggerActiveListeners().
|
||||||
|
* @param thisPtr a pointer to the TimerListener-object triggered
|
||||||
|
*
|
||||||
|
* FIXME: Due to Bochs internal timer and ips-configuration related stuff,
|
||||||
|
* the simulator sometimes panics with "keyboard error:21" (see line
|
||||||
|
* 1777 in bios/rombios.c, function keyboard_init()) if a TimerListener
|
||||||
|
* is added *before* the bios has been loaded and initialized. To
|
||||||
|
* reproduce this error, try adding a \c TimerListener as the initial step
|
||||||
|
* in your experiment code and wait for it (\c addListenerAndResume()).
|
||||||
|
* This leads to the consequence that timers cannot be added/enabled at
|
||||||
|
* boot time.
|
||||||
|
*/
|
||||||
|
void onTimerTrigger(void *thisPtr);
|
||||||
/* ********************************************************************
|
/* ********************************************************************
|
||||||
* Simulator Controller & Access API:
|
* Simulator Controller & Access API:
|
||||||
* ********************************************************************/
|
* ********************************************************************/
|
||||||
|
|||||||
@ -1,23 +1,11 @@
|
|||||||
#include "BochsListener.hpp"
|
#include "BochsListener.hpp"
|
||||||
#include "../Listener.hpp"
|
#include "../SALInst.hpp"
|
||||||
#include "../ListenerManager.hpp"
|
|
||||||
|
|
||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
void onTimerTrigger(void* thisPtr)
|
void onTimerTrigger(void* thisPtr)
|
||||||
{
|
{
|
||||||
// FIXME: The timer logic can be modified to use only one timer in Bochs.
|
simulator.onTimerTrigger(thisPtr);
|
||||||
// (For now, this suffices.)
|
|
||||||
TimerListener* pli = static_cast<TimerListener*>(thisPtr);
|
|
||||||
// Check for a matching TimerListener. (In fact, we are only
|
|
||||||
// interessted in the iterator pointing at pli.)
|
|
||||||
ListenerManager::iterator it = std::find(simulator.m_LstList.begin(),
|
|
||||||
simulator.m_LstList.end(), pli);
|
|
||||||
// TODO: This has O(|m_LstList|) time complexity. We can further improve this
|
|
||||||
// by creating a method such that makeActive(pli) works as well,
|
|
||||||
// reducing the time complexity to O(1).
|
|
||||||
simulator.m_LstList.makeActive(it);
|
|
||||||
simulator.m_LstList.triggerActiveListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end-of-namespace: fail
|
} // end-of-namespace: fail
|
||||||
|
|||||||
@ -4,20 +4,8 @@
|
|||||||
namespace fail {
|
namespace fail {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static internal handler for TimerListeners. This static function is
|
* Global internal handler for (Bochs) TimerListeners. The function just calls
|
||||||
* called when a previously registered (Bochs) timer triggers. This function
|
* BochsController::onTimerTrigger().
|
||||||
* searches for the provided TimerListener object within the ListenerManager and
|
|
||||||
* fires such an event by calling \c triggerActiveListeners().
|
|
||||||
* @param thisPtr a pointer to the TimerListener-object triggered
|
|
||||||
*
|
|
||||||
* FIXME: Due to Bochs internal timer and ips-configuration related stuff,
|
|
||||||
* the simulator sometimes panics with "keyboard error:21" (see line
|
|
||||||
* 1777 in bios/rombios.c, function keyboard_init()) if a TimerListener
|
|
||||||
* is added *before* the bios has been loaded and initialized. To
|
|
||||||
* reproduce this error, try adding a \c TimerListener as the initial step
|
|
||||||
* in your experiment code and wait for it (\c addListenerAndResume()).
|
|
||||||
* This leads to the consequence that timers cannot be added/enabled at
|
|
||||||
* boot time.
|
|
||||||
*/
|
*/
|
||||||
void onTimerTrigger(void *thisPtr);
|
void onTimerTrigger(void *thisPtr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user