Make it comile again with CONFIG_FAST_BREAKPOINTS enabled (avoid include cycle, see r1706), set timer id correctly (setId), coding-style + comment fix.
git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1712 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
@ -211,22 +211,6 @@ void BochsController::fireInterruptDone()
|
|||||||
m_Flows.toggle(m_CurrFlow);
|
m_Flows.toggle(m_CurrFlow);
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string& BochsController::getMnemonic() const
|
const std::string& BochsController::getMnemonic() const
|
||||||
{
|
{
|
||||||
static std::string str;
|
static std::string str;
|
||||||
|
|||||||
@ -64,23 +64,6 @@ 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);
|
||||||
/**
|
|
||||||
* Static internal handler for TimerListeners. This static function is
|
|
||||||
* called when a previously registered (Bochs) timer triggers. This function
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
static void onTimerTrigger(void *thisPtr);
|
|
||||||
/* ********************************************************************
|
/* ********************************************************************
|
||||||
* Simulator Controller & Access API:
|
* Simulator Controller & Access API:
|
||||||
* ********************************************************************/
|
* ********************************************************************/
|
||||||
|
|||||||
@ -1,43 +1,45 @@
|
|||||||
#ifndef __BOCHSLISTENER_AH__
|
#ifndef __BOCHS_LISTENER_AH__
|
||||||
#define __BOCHSLISTENER_AH__
|
#define __BOCHS_LISTENER_AH__
|
||||||
|
|
||||||
#include "config/VariantConfig.hpp"
|
#include "config/VariantConfig.hpp"
|
||||||
#include "config/FailConfig.hpp"
|
#include "config/FailConfig.hpp"
|
||||||
|
|
||||||
#if defined(BUILD_BOCHS) && defined(CONFIG_EVENT_BREAKPOINTS)
|
#if defined(BUILD_BOCHS) && defined(CONFIG_EVENT_BREAKPOINTS)
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
#include "bochs.h"
|
#include "bochs.h"
|
||||||
#include "BochsController.hpp"
|
#include "BochsListener.hpp"
|
||||||
|
|
||||||
aspect BochsListener
|
/*
|
||||||
{
|
* Note: A (Fail)Bochs bug currently leads to the consequence that timers
|
||||||
advice "fail::TimerListener" : slice class
|
* cannot be added/enabled at boot time (see BochsController.hpp for further
|
||||||
{
|
* details).
|
||||||
|
*/
|
||||||
|
aspect BochsListener {
|
||||||
|
advice "fail::TimerListener" : slice class {
|
||||||
public:
|
public:
|
||||||
bool onAddition()
|
bool onAddition()
|
||||||
{
|
{
|
||||||
// Register the timer listener in the Bochs simulator:
|
// Register the timer listener in the Bochs simulator:
|
||||||
setId(m_registerTimer(this));
|
if(m_registerTimer(this) == -1) {
|
||||||
if(getId() == -1)
|
setId(INVALID_TIMER);
|
||||||
return false; // unable to register the timer (error in Bochs' function call)
|
return false; // unable to register the timer (error in Bochs' function call)
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDeletion()
|
void onDeletion()
|
||||||
{
|
{
|
||||||
// Unregister the time listener:
|
// Unregister the time listener:
|
||||||
m_unregisterTimer(this);
|
m_unregisterTimer(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
timer_id_t m_registerTimer(TimerListener* pev)
|
timer_id_t m_registerTimer(TimerListener* pev)
|
||||||
{
|
{
|
||||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||||
return static_cast<timer_id_t>(
|
return static_cast<timer_id_t>(
|
||||||
bx_pc_system.register_timer(pev, BochsController::onTimerTrigger, pev->getTimeout(),
|
bx_pc_system.register_timer(pev, fail::onTimerTrigger, pev->getTimeout(),
|
||||||
false, 1/*start immediately*/, "Fail*: BochsController"/*name*/));
|
false, 1/*start immediately*/, "Fail*: BochsController"/*name*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_unregisterTimer(TimerListener* pev)
|
bool m_unregisterTimer(TimerListener* pev)
|
||||||
{
|
{
|
||||||
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
assert(pev != NULL && "FATAL ERROR: TimerListener object ptr cannot be NULL!");
|
||||||
@ -48,4 +50,4 @@ aspect BochsListener
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILD_BOCHS && CONFIG_EVENT_BREAKPOINTS
|
#endif // BUILD_BOCHS && CONFIG_EVENT_BREAKPOINTS
|
||||||
#endif // __BOCHSLISTENER_AH__
|
#endif // __BOCHS_LISTENER_AH__
|
||||||
|
|||||||
23
src/core/sal/bochs/BochsListener.cc
Normal file
23
src/core/sal/bochs/BochsListener.cc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#include "BochsListener.hpp"
|
||||||
|
#include "../Listener.hpp"
|
||||||
|
#include "../ListenerManager.hpp"
|
||||||
|
|
||||||
|
namespace fail {
|
||||||
|
|
||||||
|
void 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end-of-namespace: fail
|
||||||
26
src/core/sal/bochs/BochsListener.hpp
Normal file
26
src/core/sal/bochs/BochsListener.hpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef __BOCHS_LISTENER_HPP__
|
||||||
|
#define __BOCHS_LISTENER_HPP__
|
||||||
|
|
||||||
|
namespace fail {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static internal handler for TimerListeners. This static function is
|
||||||
|
* called when a previously registered (Bochs) timer triggers. This function
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
} // end-of-namespace: fail
|
||||||
|
|
||||||
|
#endif // __BOCHS_LISTENER_HPP__
|
||||||
Reference in New Issue
Block a user