ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Injector.h
Go to the documentation of this file.
1 
52 #ifndef ETISS_INJECTOR_H_
53 #define ETISS_INJECTOR_H_
54 
55 #ifndef NO_ETISS
56 #include "etiss/fault/Fault.h"
57 #else
58 #include "fault/Fault.h"
59 #endif
60 
61 #if CXX0X_UP_SUPPORTED
62 #include <functional>
63 #include <memory>
64 #include <mutex>
65 #endif
66 
67 #include <fstream>
68 
69 namespace etiss
70 {
71 
72 namespace fault
73 {
74 
75 class Stressor;
76 
77 class Injector
78 {
79  public:
80 #if CXX0X_UP_SUPPORTED
81  typedef std::shared_ptr<Injector> ptr;
82 #else
83  typedef Injector *ptr;
84 #endif
85 
86  public: // override in inheriting classes
87  Injector();
88  virtual ~Injector(){};
93  virtual std::list<std::string> listFields() = 0;
98  virtual std::list<std::string> listSubInjectors() = 0;
99 
105  virtual ptr getSubInjector(const std::string &name) = 0;
111  virtual ptr getParentInjector() = 0;
112 
113  public: // callbacks
114  virtual bool needsCallbacks();
115  virtual bool cycleAccurateCallback(uint64_t time_ps); // returns if trigger fired
116  virtual bool instructionAccurateCallback(uint64_t time_ps); // returns if trigger fired
117 
118  public: // currently public functions but might become protected later on
128  virtual void *fastFieldAccessPtr(const std::string &name, std::string &errormsg) = 0;
137  virtual void freeFastFieldAccessPtr(void *);
146  virtual bool readField(void *fastfieldaccessptr, uint64_t &val, std::string &errormsg) = 0;
153  virtual bool applyAction(const etiss::fault::Fault &fault, const etiss::fault::Action &action,
154  std::string &errormsg) = 0;
155 
156  virtual bool acceleratedTrigger(const etiss::fault::Trigger &, int32_t fault_id);
157 
158  public: // static
164  static ptr get(const std::string &injectorPath);
165 
172  virtual std::string getInjectorPath();
173 
174  private:
175 #if CXX0X_UP_SUPPORTED
176  std::mutex sync;
177 #endif
178  volatile bool has_pending_triggers;
179  std::list<std::pair<Trigger, int32_t>> pending_triggers;
180  std::list<std::pair<Trigger, int32_t>> unknown_triggers;
182 
183  public: // interface fot stressor
184  void addTrigger(const Trigger &t, int32_t fault_id);
185 };
186 
187 } // namespace fault
188 
189 } // namespace etiss
190 
191 #endif
contains the fault container class that stores triggers and actions for fault injection
static __inline__ uint64_t
Definition: arm_cde.h:31
static __inline__ int32_t
Definition: arm_mve.h:51
virtual bool readField(void *fastfieldaccessptr, uint64_t &val, std::string &errormsg)=0
read the value of a field
virtual bool applyAction(const etiss::fault::Fault &fault, const etiss::fault::Action &action, std::string &errormsg)=0
virtual bool acceleratedTrigger(const etiss::fault::Trigger &, int32_t fault_id)
Definition: Injector.cpp:225
virtual ptr getParentInjector()=0
get a the parent injector (root returns 0).
virtual void freeFastFieldAccessPtr(void *)
MUST be called to cleanup a pointer acquired with fastFieldAccessPtr() default implementation is nop.
Definition: Injector.cpp:67
virtual bool needsCallbacks()
Definition: Injector.cpp:73
virtual std::string getInjectorPath()
returns the path of the current object.
Definition: Injector.cpp:142
virtual ~Injector()
Definition: Injector.h:88
virtual ptr getSubInjector(const std::string &name)=0
get a sub injector.
static ptr get(const std::string &injectorPath)
virtual std::list< std::string > listSubInjectors()=0
list all sub injectors.
virtual void * fastFieldAccessPtr(const std::string &name, std::string &errormsg)=0
volatile bool has_pending_triggers
Definition: Injector.h:178
std::list< std::pair< Trigger, int32_t > > unknown_triggers
> Triggers which were just added
Definition: Injector.h:180
virtual bool instructionAccurateCallback(uint64_t time_ps)
Definition: Injector.cpp:123
virtual std::list< std::string > listFields()=0
list all fields directly reachable by this injector
virtual bool cycleAccurateCallback(uint64_t time_ps)
Definition: Injector.cpp:79
std::list< std::pair< Trigger, int32_t > > pending_triggers
Definition: Injector.h:179
void addTrigger(const Trigger &t, int32_t fault_id)
> Triggers to look at in callbacks
Definition: Injector.cpp:204
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53