ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
IntegratedLibrary.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
16#define ETISS_LIBNAME ETISSINCLUDED
17
21
23
28
29#include "etiss/CPUArch.h"
30#include "etiss/JIT.h"
31#include "etiss/Plugin.h"
32
33extern "C"
34{
35
36 // implement version function
38
40 {
41 return 0;
42 }
43
45 {
46 return 0;
47 }
48
50 {
51 return 4;
52 }
53
54 const char *ETISSINCLUDED_nameJIT(unsigned index)
55 {
56 return 0;
57 }
58
59 const char *ETISSINCLUDED_nameCPUArch(unsigned index)
60 {
61 return 0;
62 }
63
64 const char *ETISSINCLUDED_namePlugin(unsigned index)
65 {
66 switch (index)
67 {
68 case 0:
69 return "BlockAccurateHandler";
70 case 1:
71 return "gdbserver";
72 case 2:
73 return "PrintInstruction";
74 case 3:
75 return "Logger";
76 }
77 return 0;
78 }
79
80 etiss::JIT *ETISSINCLUDED_createJIT(unsigned index, std::map<std::string, std::string> options)
81 {
82 return 0;
83 }
84
85 etiss::CPUArch *ETISSINCLUDED_createCPUArch(unsigned index, std::map<std::string, std::string> options)
86 {
87 return 0;
88 }
89
90 etiss::Plugin *ETISSINCLUDED_createPlugin(unsigned index, std::map<std::string, std::string> options)
91 {
92 switch (index)
93 {
94 case 0:
95 {
99 for (auto iter = options.begin(); iter != options.end(); iter++)
100 {
101 if (iter->first.length() > 2 && iter->first[0] == '-' && iter->first[1] == 'r')
102 {
103 std::string regname = iter->first.substr(2);
104 ret->parseFile(iter->second, regname);
105 }
106 else
107 {
109 std::string("IntegratedLibrary: failed to parse option for BlockAccurateHandler: ") +
110 iter->first + "->" + iter->second);
111 }
112 }
113 return ret;
114 }
115 case 1:
117 case 2:
119 case 3:
121 cfg.config() = options;
122 return new etiss::plugin::Logger(cfg.get<uint64_t>("plugin.logger.logaddr", 0x80000000),
123 cfg.get<uint64_t>("plugin.logger.logmask", 0xF0000000));
124 }
125 return 0;
126 }
127
129 {
130 delete o;
131 }
132
134 {
135 delete o;
136 }
137
139 {
140 delete o;
141 }
142}
143
144// not part of the example implementation
146{
147 return ETISSINCLUDED_etissversion();
148}
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
contains neccesary interfaces for instruction translation.
void ETISSINCLUDED_deleteJIT(etiss::JIT *o)
ETISS_LIBRARYIF_VERSION_FUNC_IMPL unsigned ETISSINCLUDED_countJIT()
const char * ETISSINCLUDED_nameJIT(unsigned index)
unsigned ETISSINCLUDED_countCPUArch()
unsigned ETISSINCLUDED_countPlugin()
etiss::Plugin * ETISSINCLUDED_createPlugin(unsigned index, std::map< std::string, std::string > options)
etiss::CPUArch * ETISSINCLUDED_createCPUArch(unsigned index, std::map< std::string, std::string > options)
etiss::JIT * ETISSINCLUDED_createJIT(unsigned index, std::map< std::string, std::string > options)
const char * ETISSINCLUDED_namePlugin(unsigned index)
void ETISSINCLUDED_deleteCPUArch(etiss::CPUArch *o)
const char * ETISSINCLUDED_nameCPUArch(unsigned index)
void ETISSINCLUDED_deletePlugin(etiss::Plugin *o)
defines the functions needed for a library that provides etiss::JIT implementations
JIT compiler interface definition.
class for simple library access.
defines the functions needed for a library that provides etiss::CPUArch implementations
plugins for extensions to code translation and instruction execution
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:116
simple class to hold configuration options
Definition Misc.h:296
compiler interface for just in time compilation of generated C code
Definition JIT.h:29
static unsigned getCurrentLibraryVersion()
base plugin class that provides access to different plugin functions if present
Definition Plugin.h:38
simple logger implementation.
Definition Logger.h:23
a simple plugin that prints the instruction and address when an instruction is executed
Register error injection class.
Definition Plugin.h:41
void parseFile(std::string filename, std::string reg)
reads a file and adds the errors.
Definition Plugin.cpp:121
static Server * createTCPServer(std::map< std::string, std::string > options)
#define ETISS_LIBRARYIF_VERSION_FUNC_IMPL
Definition Misc.h:47
@ WARNING
Definition Misc.h:86
void log(Verbosity level, std::string msg)
write log message at the given level.
Definition Misc.cpp:94