Pre-/postprocessing is done within the event objects (Bochs-specific event added), ++coding-style.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1366 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-21 10:47:22 +00:00
parent 5effe564f0
commit ad0cfb9b11
12 changed files with 420 additions and 438 deletions

View File

@ -8,6 +8,7 @@
#include <string.h>
#include "FailBochsGlobals.hpp"
#include "BochsEvents.hpp"
#include "../SimulatorController.hpp"
#include "../Event.hpp"
@ -34,40 +35,6 @@ private:
unsigned m_Counter; //! current instr-ptr counter
std::ostream* m_pDest; //! debug output object (defaults to \c std::cout)
#endif
/**
* Static internal event handler for TimerEvents. This static function is
* called when a previously registered (Bochs) timer triggers. This function
* searches for the provided TimerEvent object within the EventList and
* fires such an event by calling \c fireActiveEvents().
* @param thisPtr a pointer to the TimerEvent-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 TimerEvent
* is added *before* the bios has been loaded and initialized. To
* reproduce this error, try adding a TimerEvent as the initial step
* in your experiment code and wait for it (addEventAndWait()).
*/
static void m_onTimerTrigger(void *thisPtr);
/**
* Registers a timer in the Bochs simulator. This timer fires \a TimerEvents
* to inform the corresponding experiment-flow. Note that the number of timers
* (in Bochs) is limited to \c BX_MAX_TIMERS (defaults to 64 in v2.4.6).
* @param pev a pointer to the (experiment flow-) allocated TimerEvent object,
* providing all required information to start the time, e.g. the
* timeout value.
* @return \c The unique id of the timer recently created. This id is carried
* along with the TimerEvent, @see getId(). On error, -1 is returned
* (e.g. because a timer with the same id is already existing)
*/
timer_id_t m_registerTimer(TimerEvent* pev);
/**
* Deletes a timer. No further events will be triggered by the timer.
* @param pev a pointer to the TimerEvent-object to be removed
* @return \c true if the timer with \a pev->getId() has been removed
* successfully, \c false otherwise
*/
bool m_unregisterTimer(TimerEvent* pev);
public:
// Initialize the controller.
BochsController();
@ -81,7 +48,8 @@ public:
* @param instrPtr the new instruction pointer
* @param address_space the address space the CPU is currently in
*/
void onInstrPtrChanged(address_t instrPtr, address_t address_space, BX_CPU_C *context, bxICacheEntry_c *cache_entry);
void onInstrPtrChanged(address_t instrPtr, address_t address_space, BX_CPU_C *context,
bxICacheEntry_c *cache_entry);
/**
* I/O port communication handler. This method is called (from
* the IOPortCom aspect) every time when Bochs performs a port I/O operation.
@ -91,31 +59,20 @@ public:
*/
void onIOPortEvent(unsigned char data, unsigned port, bool out);
/**
* This method is called when an experiment flow adds a new event by
* calling \c simulator.addEvent(pev) or \c simulator.addEventAndWait(pev).
* More specifically, the event will be added to the event-list first
* (buffer-list, to be precise) and then this event handler is called.
* @param pev the event which has been added
* @return You should return \c true to continue and \c false to prevent
* the addition of the event \a pev.
* Static internal event handler for TimerEvents. This static function is
* called when a previously registered (Bochs) timer triggers. This function
* searches for the provided TimerEvent object within the EventList and
* fires such an event by calling \c fireActiveEvents().
* @param thisPtr a pointer to the TimerEvent-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 TimerEvent
* is added *before* the bios has been loaded and initialized. To
* reproduce this error, try adding a \c TimerEvent as the initial step
* in your experiment code and wait for it (\c addEventAndWait()).
*/
bool onEventAddition(BaseEvent* pev);
/**
* This method is called when an experiment flow removes an event from
* the event-management by calling \c removeEvent(prev), \c clearEvents()
* or by deleting a complete flow (\c removeFlow). More specifically,
* this event handler will be called *before* the event is actually deleted.
* @param pev the event to be deleted when returning from the event handler
*/
void onEventDeletion(BaseEvent* pev);
/**
* This method is called when an previously added event is about to be
* triggered by the simulator-backend. More specifically, this event handler
* will be called *before* the event is actually triggered, i.e. before the
* corresponding coroutine is toggled.
* @param pev the event to be triggered when returning from the event handler
*/
void onEventTrigger(BaseEvent* pev);
static void onTimerTrigger(void *thisPtr);
/* ********************************************************************
* Simulator Controller & Access API:
* ********************************************************************/