ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
IntegratedLibrary.cpp
Go to the documentation of this file.
1 
54 #define ETISS_LIBNAME ETISSINCLUDED
55 
59 
60 #include "etiss/LibraryInterface.h"
61 
66 
67 extern "C"
68 {
69 
70  // implement version function
72 
73  unsigned ETISSINCLUDED_countJIT() { return 0; }
74 
75  unsigned ETISSINCLUDED_countCPUArch() { return 0; }
76 
77  unsigned ETISSINCLUDED_countPlugin() { return 4; }
78 
79  const char *ETISSINCLUDED_nameJIT(unsigned index) { return 0; }
80 
81  const char *ETISSINCLUDED_nameCPUArch(unsigned index) { return 0; }
82 
83  const char *ETISSINCLUDED_namePlugin(unsigned index)
84  {
85  switch (index)
86  {
87  case 0:
88  return "BlockAccurateHandler";
89  case 1:
90  return "gdbserver";
91  case 2:
92  return "PrintInstruction";
93  case 3:
94  return "Logger";
95  }
96  return 0;
97  }
98 
99  etiss::JIT *ETISSINCLUDED_createJIT(unsigned index, std::map<std::string, std::string> options) { return 0; }
100 
101  etiss::CPUArch *ETISSINCLUDED_createCPUArch(unsigned index, std::map<std::string, std::string> options)
102  {
103  return 0;
104  }
105 
106  etiss::Plugin *ETISSINCLUDED_createPlugin(unsigned index, std::map<std::string, std::string> options)
107  {
108  switch (index)
109  {
110  case 0:
111  {
115  for (auto iter = options.begin(); iter != options.end(); iter++)
116  {
117  if (iter->first.length() > 2 && iter->first[0] == '-' && iter->first[1] == 'r')
118  {
119  std::string regname = iter->first.substr(2);
120  ret->parseFile(iter->second, regname);
121  }
122  else
123  {
125  std::string("IntegratedLibrary: failed to parse option for BlockAccurateHandler: ") +
126  iter->first + "->" + iter->second);
127  }
128  }
129  return ret;
130  }
131  case 1:
133  case 2:
134  return new etiss::plugin::PrintInstruction();
135  case 3:
137  cfg.config() = options;
138  return new etiss::plugin::Logger(cfg.get<uint64_t>("plugin.logger.logaddr", 0x80000000),
139  cfg.get<uint64_t>("plugin.logger.logmask", 0xF0000000));
140  }
141  return 0;
142  }
143 
144  void ETISSINCLUDED_deleteJIT(etiss::JIT *o) { delete o; }
145 
147 
149 }
150 
151 // not part of the example implementation
153 {
154  return ETISSINCLUDED_etissversion();
155 }
defines the functions needed for a library that provides etiss::CPUArch implementations
ETISS_PLUGIN_EXPORT etiss::CPUArch std::map< std::string, std::string > options
create new instance of the CPUArch type at index
void ETISSINCLUDED_deleteJIT(etiss::JIT *o)
ETISS_LIBRARYIF_VERSION_FUNC_IMPL unsigned ETISSINCLUDED_countJIT()
unsigned ETISSINCLUDED_countCPUArch()
unsigned ETISSINCLUDED_countPlugin()
etiss::Plugin * ETISSINCLUDED_createPlugin(unsigned index, std::map< std::string, std::string > options)
etiss::JIT * ETISSINCLUDED_createJIT(unsigned index, std::map< std::string, std::string > options)
etiss::CPUArch * ETISSINCLUDED_createCPUArch(unsigned index, std::map< std::string, std::string > options)
const char * ETISSINCLUDED_nameJIT(unsigned index)
const char * ETISSINCLUDED_nameCPUArch(unsigned index)
const char * ETISSINCLUDED_namePlugin(unsigned index)
void ETISSINCLUDED_deleteCPUArch(etiss::CPUArch *o)
void ETISSINCLUDED_deletePlugin(etiss::Plugin *o)
defines the functions needed for a library that provides etiss::JIT implementations
class for simple library access.
defines the functions needed for a library that provides etiss::CPUArch implementations
contains a simple plugin to print instructions
static __inline__ uint64_t
Definition: arm_cde.h:31
the interface to translate instructions of and processor architecture
Definition: CPUArch.h:162
simple class to hold configuration options
Definition: Misc.h:333
compiler interface for just in time compilation of generated C code
Definition: JIT.h:67
static unsigned getCurrentLibraryVersion()
base plugin class that provides access to different plugin functions if present
Definition: Plugin.h:77
simple logger implementation.
Definition: Logger.h:59
a simple plugin that prints the instruction and address when an instruction is executed
Register error injection class.
Definition: Plugin.h:79
void parseFile(std::string filename, std::string reg)
reads a file and adds the errors.
Definition: Plugin.cpp:158
static Server * createTCPServer(std::map< std::string, std::string > options)
Definition: GDBServer.cpp:833
#define ETISS_LIBRARYIF_VERSION_FUNC_IMPL
Definition: Misc.h:85
@ WARNING
Definition: Misc.h:128
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition: Misc.cpp:125