coding-style improved.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@1364 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
adrian
2012-06-20 08:42:58 +00:00
parent 583f60c430
commit 127a25707f
2 changed files with 718 additions and 734 deletions

View File

@ -31,18 +31,17 @@ const unsigned ANY_INTERRUPT = static_cast<unsigned>(-1);
* \class BaseEvent * \class BaseEvent
* This is the base class for all event types. * This is the base class for all event types.
*/ */
class BaseEvent class BaseEvent {
{ private:
private:
//! current class-scoped id counter to provide \a unique id's //! current class-scoped id counter to provide \a unique id's
static EventId m_Counter; static EventId m_Counter;
protected: protected:
EventId m_Id; //!< unique id of this event EventId m_Id; //!< unique id of this event
time_t m_tStamp; //!< time stamp of event time_t m_tStamp; //!< time stamp of event
unsigned int m_OccCounter; //!< event fires when 0 is reached unsigned int m_OccCounter; //!< event fires when 0 is reached
unsigned int m_OccCounterInit; //!< initial value for m_OccCounter unsigned int m_OccCounterInit; //!< initial value for m_OccCounter
ExperimentFlow* m_Parent; //!< this event belongs to experiment m_Parent ExperimentFlow* m_Parent; //!< this event belongs to experiment m_Parent
public: public:
BaseEvent() : m_Id(++m_Counter), m_OccCounter(1), m_OccCounterInit(1), m_Parent(NULL) BaseEvent() : m_Id(++m_Counter), m_OccCounter(1), m_OccCounterInit(1), m_Parent(NULL)
{ updateTime(); } { updateTime(); }
virtual ~BaseEvent() { } virtual ~BaseEvent() { }
@ -102,12 +101,11 @@ class BaseEvent
* \class BEvent * \class BEvent
* A Breakpoint event to observe instruction changes within a given address space. * A Breakpoint event to observe instruction changes within a given address space.
*/ */
class BPEvent : virtual public BaseEvent class BPEvent : virtual public BaseEvent {
{ private:
private:
address_t m_CR3; address_t m_CR3;
address_t m_TriggerInstrPtr; address_t m_TriggerInstrPtr;
public: public:
/** /**
* Creates a new breakpoint event. The range information is specific to * Creates a new breakpoint event. The range information is specific to
* the subclasses. * the subclasses.
@ -155,11 +153,10 @@ class BPEvent : virtual public BaseEvent
* \class BPSingleEvent * \class BPSingleEvent
* A Breakpoint event to observe specific instruction pointers. * A Breakpoint event to observe specific instruction pointers.
*/ */
class BPSingleEvent : virtual public BPEvent class BPSingleEvent : virtual public BPEvent {
{ private:
private:
address_t m_WatchInstrPtr; address_t m_WatchInstrPtr;
public: public:
/** /**
* Creates a new breakpoint event. * Creates a new breakpoint event.
* @param ip the instruction pointer of the breakpoint. If the control * @param ip the instruction pointer of the breakpoint. If the control
@ -194,12 +191,11 @@ class BPSingleEvent : virtual public BPEvent
* \class BPRangeEvent * \class BPRangeEvent
* A event type to observe ranges of instruction pointers. * A event type to observe ranges of instruction pointers.
*/ */
class BPRangeEvent : virtual public BPEvent class BPRangeEvent : virtual public BPEvent {
{ private:
private:
address_t m_WatchStartAddr; address_t m_WatchStartAddr;
address_t m_WatchEndAddr; address_t m_WatchEndAddr;
public: public:
/** /**
* Creates a new breakpoint-range event. The range's ends are both * Creates a new breakpoint-range event. The range's ends are both
* inclusive, i.e. an address matches if start <= addr <= end. * inclusive, i.e. an address matches if start <= addr <= end.
@ -232,17 +228,15 @@ class BPRangeEvent : virtual public BPEvent
* FIXME? currently >8-bit accesses only match if their lowest address is being watched * FIXME? currently >8-bit accesses only match if their lowest address is being watched
* (e.g., a 32-bit write to 0x4 also accesses 0x7, but this cannot be matched) * (e.g., a 32-bit write to 0x4 also accesses 0x7, but this cannot be matched)
*/ */
class MemAccessEvent : virtual public BaseEvent class MemAccessEvent : virtual public BaseEvent {
{ public:
public: enum accessType_t {
enum accessType_t
{
MEM_UNKNOWN = 0x0, MEM_UNKNOWN = 0x0,
MEM_READ = 0x1, MEM_READ = 0x1,
MEM_WRITE = 0x2, MEM_WRITE = 0x2,
MEM_READWRITE = 0x3 MEM_READWRITE = 0x3
}; };
private: private:
//! Specific guest system address to watch, or ANY_ADDR. //! Specific guest system address to watch, or ANY_ADDR.
address_t m_WatchAddr; address_t m_WatchAddr;
/** /**
@ -258,7 +252,7 @@ class MemAccessEvent : virtual public BaseEvent
address_t m_TriggerIP; address_t m_TriggerIP;
//! Memory access type at m_TriggerAddr. //! Memory access type at m_TriggerAddr.
accessType_t m_AccessType; accessType_t m_AccessType;
public: public:
MemAccessEvent(accessType_t watchtype = MEM_READWRITE) MemAccessEvent(accessType_t watchtype = MEM_READWRITE)
: m_WatchAddr(ANY_ADDR), m_WatchType(watchtype), : m_WatchAddr(ANY_ADDR), m_WatchType(watchtype),
m_TriggerAddr(ANY_ADDR), m_TriggerIP(ANY_ADDR), m_TriggerAddr(ANY_ADDR), m_TriggerIP(ANY_ADDR),
@ -333,9 +327,8 @@ class MemAccessEvent : virtual public BaseEvent
* \class MemReadEvent * \class MemReadEvent
* Observes memory read accesses. * Observes memory read accesses.
*/ */
class MemReadEvent : virtual public MemAccessEvent class MemReadEvent : virtual public MemAccessEvent {
{ public:
public:
MemReadEvent() MemReadEvent()
: MemAccessEvent(MEM_READ) { } : MemAccessEvent(MEM_READ) { }
MemReadEvent(address_t addr) MemReadEvent(address_t addr)
@ -346,9 +339,8 @@ class MemReadEvent : virtual public MemAccessEvent
* \class MemWriteEvent * \class MemWriteEvent
* Observes memory write accesses. * Observes memory write accesses.
*/ */
class MemWriteEvent : virtual public MemAccessEvent class MemWriteEvent : virtual public MemAccessEvent {
{ public:
public:
MemWriteEvent() MemWriteEvent()
: MemAccessEvent(MEM_READ) { } : MemAccessEvent(MEM_READ) { }
MemWriteEvent(address_t addr) MemWriteEvent(address_t addr)
@ -359,9 +351,8 @@ class MemWriteEvent : virtual public MemAccessEvent
* \class TroubleEvent * \class TroubleEvent
* Observes interrupt/trap activties. * Observes interrupt/trap activties.
*/ */
class TroubleEvent : virtual public BaseEvent class TroubleEvent : virtual public BaseEvent {
{ private:
private:
/** /**
* Specific guest system interrupt/trap number that actually * Specific guest system interrupt/trap number that actually
* trigger the event. * trigger the event.
@ -372,7 +363,7 @@ class TroubleEvent : virtual public BaseEvent
* or ANY_INTERRUPT/ANY_TRAP. * or ANY_INTERRUPT/ANY_TRAP.
*/ */
std::vector<unsigned> m_WatchNumbers; std::vector<unsigned> m_WatchNumbers;
public: public:
TroubleEvent() : m_TriggerNumber (-1) { } TroubleEvent() : m_TriggerNumber (-1) { }
TroubleEvent(unsigned troubleNumber) TroubleEvent(unsigned troubleNumber)
: m_TriggerNumber(-1) : m_TriggerNumber(-1)
@ -418,11 +409,10 @@ class TroubleEvent : virtual public BaseEvent
* \class InterruptEvent * \class InterruptEvent
* Observes interrupts of the guest system. * Observes interrupts of the guest system.
*/ */
class InterruptEvent : virtual public TroubleEvent class InterruptEvent : virtual public TroubleEvent {
{ private:
private:
bool m_IsNMI; //!< non maskable interrupt flag bool m_IsNMI; //!< non maskable interrupt flag
public: public:
InterruptEvent() : m_IsNMI(false) { } InterruptEvent() : m_IsNMI(false) { }
InterruptEvent(unsigned interrupt) : m_IsNMI(false) InterruptEvent(unsigned interrupt) : m_IsNMI(false)
{ addWatchNumber(interrupt); } { addWatchNumber(interrupt); }
@ -440,9 +430,8 @@ class InterruptEvent : virtual public TroubleEvent
* \class TrapEvent * \class TrapEvent
* Observes traps of the guest system. * Observes traps of the guest system.
*/ */
class TrapEvent : virtual public TroubleEvent class TrapEvent : virtual public TroubleEvent {
{ public:
public:
TrapEvent() { } TrapEvent() { }
TrapEvent(unsigned trap) { addWatchNumber(trap); } TrapEvent(unsigned trap) { addWatchNumber(trap); }
}; };
@ -451,12 +440,11 @@ class TrapEvent : virtual public TroubleEvent
* \class GuestEvent * \class GuestEvent
* Used to receive data from the guest system. * Used to receive data from the guest system.
*/ */
class GuestEvent : virtual public BaseEvent class GuestEvent : virtual public BaseEvent {
{ private:
private:
char m_Data; char m_Data;
unsigned m_Port; unsigned m_Port;
public: public:
GuestEvent() : m_Data(0), m_Port(0) { } GuestEvent() : m_Data(0), m_Port(0) { }
/** /**
* Returns the data, transmitted by the guest system. * Returns the data, transmitted by the guest system.
@ -480,13 +468,12 @@ class GuestEvent : virtual public BaseEvent
* \class IOPortEvent * \class IOPortEvent
* Observes I/O access on architectures with a separate I/O access mechanism (e.g. IA-32) * Observes I/O access on architectures with a separate I/O access mechanism (e.g. IA-32)
*/ */
class IOPortEvent : virtual public BaseEvent class IOPortEvent : virtual public BaseEvent {
{ private:
private:
unsigned char m_Data; unsigned char m_Data;
unsigned m_Port; unsigned m_Port;
bool m_Out; bool m_Out;
public: public:
/** /**
* Initialises an IOPortEvent * Initialises an IOPortEvent
* *
@ -534,12 +521,11 @@ class IOPortEvent : virtual public BaseEvent
* \class JumpEvent * \class JumpEvent
* JumpEvents are used to observe conditional jumps (if...else if...else). * JumpEvents are used to observe conditional jumps (if...else if...else).
*/ */
class JumpEvent : virtual public BaseEvent class JumpEvent : virtual public BaseEvent {
{ private:
private:
unsigned m_Opcode; unsigned m_Opcode;
bool m_FlagTriggered; bool m_FlagTriggered;
public: public:
/** /**
* Constructs a new event object. * Constructs a new event object.
* @param parent the parent object * @param parent the parent object
@ -577,13 +563,12 @@ class JumpEvent : virtual public BaseEvent
* \class TimerEvent * \class TimerEvent
* This event type is used to create timeouts/timers within in an experiment. * This event type is used to create timeouts/timers within in an experiment.
*/ */
class TimerEvent : public BaseEvent class TimerEvent : public BaseEvent {
{ private:
private:
unsigned m_Timeout; //!< timeout interval in milliseconds unsigned m_Timeout; //!< timeout interval in milliseconds
timer_id_t m_Id; //!< internal timer id (sim-specific) timer_id_t m_Id; //!< internal timer id (sim-specific)
bool m_Once; //!< true, if the timer should be triggered only once bool m_Once; //!< true, if the timer should be triggered only once
public: public:
/** /**
* Creates a new timer event. This can be used to implement a timeout- * Creates a new timer event. This can be used to implement a timeout-
* mechanism in the experiment-flow. The timer starts automatically when * mechanism in the experiment-flow. The timer starts automatically when

View File

@ -31,9 +31,8 @@ class MemoryManager;
* activates the specific experiment There are further methods to read/write * activates the specific experiment There are further methods to read/write
* registers and memory, and control the SUT (save/restore/reset). * registers and memory, and control the SUT (save/restore/reset).
*/ */
class SimulatorController class SimulatorController {
{ protected:
protected:
EventList m_EvList; //!< storage where events are being buffered EventList m_EvList; //!< storage where events are being buffered
CoroutineManager m_Flows; //!< managed experiment flows CoroutineManager m_Flows; //!< managed experiment flows
RegisterManager *m_Regs; //!< access to cpu register RegisterManager *m_Regs; //!< access to cpu register
@ -41,7 +40,7 @@ class SimulatorController
//! list of suppressed interrupts //! list of suppressed interrupts
std::vector<unsigned> m_SuppressedInterrupts; std::vector<unsigned> m_SuppressedInterrupts;
friend class EventList; //!< "outsources" the event management friend class EventList; //!< "outsources" the event management
public: public:
SimulatorController() SimulatorController()
: m_Regs(NULL), m_Mem(NULL) { } : m_Regs(NULL), m_Mem(NULL) { }
SimulatorController(RegisterManager* regs, MemoryManager* mem) SimulatorController(RegisterManager* regs, MemoryManager* mem)