ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
CPUArch.h
Go to the documentation of this file.
1 
54 #ifndef ETISS_INCLUDE_CPUARCH_H_
55 #define ETISS_INCLUDE_CPUARCH_H_
56 
57 #include <map>
58 #include <set>
59 #include <string>
60 
61 #include "etiss/CodePart.h"
62 #include "etiss/Instruction.h"
64 #include "etiss/InterruptVector.h"
65 #include "etiss/InterruptEnable.h"
66 #include "etiss/Plugin.h"
67 #include "etiss/VirtualStruct.h"
68 #include "etiss/jit/CPU.h"
69 #include "etiss/jit/ReturnCode.h"
70 #include "etiss/jit/System.h"
71 #include "etiss/mm/MMU.h"
72 
73 namespace etiss
74 {
75 
83 {
84  public:
86 
90  virtual const std::set<std::string> &getListenerSupportedRegisters() = 0;
91 
92  public:
117  static void signalChangedRegisterValue(ETISS_CPU *cpu, const char *registerName);
118 };
119 
126 {
127  public:
128  virtual ~CPUArchCPUManipulation();
129 
133  virtual std::shared_ptr<etiss::VirtualStruct> getVirtualStruct(ETISS_CPU *cpu) = 0;
134 };
135 
140 {
141  public:
147  virtual etiss::Plugin *newTimer(ETISS_CPU *cpu);
152  virtual void deleteTimer(etiss::Plugin *timer);
153 };
154 
159  public CPUArchCPUManipulation,
160  public CPUArchDefaultPlugins,
161  public TranslationPlugin
162 {
163  friend class LibraryInterface;
164 
165  public:
170  CPUArch(std::string archname);
171  virtual ~CPUArch();
172 
178  std::string getArchName() const;
179 
184  inline std::string getName() const { return getArchName(); }
188  virtual ETISS_CPU *newCPU() = 0;
192  virtual void resetCPU(ETISS_CPU *cpu, etiss::uint64 *startpointer) = 0;
196  virtual void deleteCPU(ETISS_CPU *) = 0;
201  virtual unsigned getMaximumInstructionSizeInBytes() = 0;
205  virtual unsigned getMaximumInstructionsPerMetaInstruction();
209  virtual unsigned getInstructionSizeInBytes() = 0;
214  virtual unsigned getSuperInstructionCount();
218  virtual std::string getBlockGlobalCode();
223  virtual bool unlikelyInstruction(etiss::uint8 *instr, unsigned length, bool &ismetainstruction);
228  virtual const std::set<std::string> &getHeaders() const = 0;
240  virtual void deleteInterruptVector(etiss::InterruptVector *vec, ETISS_CPU *cpu);
241 
244 
252  virtual std::string getIncludePath();
263  virtual void compensateEndianess(ETISS_CPU *cpu, etiss::instr::BitArray &ba) const;
264 
268  virtual etiss::mm::MMU *newMMU(ETISS_CPU *cpu) { return nullptr; }
269 
270  protected:
272  virtual std::string _getPluginName() const;
273 
274  private:
276  std::string archname_;
277 };
278 
279 } // namespace etiss
280 
281 #endif
etiss_uint8 uint8
Definition: 386-GCC.h:76
etiss_int32 int32
Definition: 386-GCC.h:81
etiss_uint64 uint64
Definition: 386-GCC.h:82
classes to hold code and additional information used for optimization of instruction translations
contains container classes to store instruction definitions + translation functions and build a trans...
defines a general interface to set interrupt bits
Modeling hardware memory management for virtual memory -> physical memory translation and protection.
plugins for extensions to code translation and instruction execution
interface for cpu structure access.
Definition: CPUArch.h:126
virtual std::shared_ptr< etiss::VirtualStruct > getVirtualStruct(ETISS_CPU *cpu)=0
this function must return a valid pointer to a virtual struct
provides common basic plugins
Definition: CPUArch.h:140
virtual etiss::Plugin * newTimer(ETISS_CPU *cpu)
create a simple default timer implementaion instance for this architecture.
Definition: CPUArch.cpp:64
virtual void deleteTimer(etiss::Plugin *timer)
delete timer instance
Definition: CPUArch.cpp:69
virtual ~CPUArchDefaultPlugins()
Definition: CPUArch.h:142
allows to inform plugins about changes to a register that is present in the cpu structure.
Definition: CPUArch.h:83
virtual const std::set< std::string > & getListenerSupportedRegisters()=0
static void signalChangedRegisterValue(ETISS_CPU *cpu, const char *registerName)
call this function to inform RegisterDevicePlugins about changed special register values.
Definition: CPUCore.cpp:43
the interface to translate instructions of and processor architecture
Definition: CPUArch.h:162
virtual void deleteCPU(ETISS_CPU *)=0
delete cpu structure
std::string archname_
Definition: CPUArch.h:276
virtual void resetCPU(ETISS_CPU *cpu, etiss::uint64 *startpointer)=0
reset cpu (structure)
virtual etiss::InterruptEnable * createInterruptEnable(ETISS_CPU *cpu)
Definition: CPUArch.cpp:138
virtual etiss::mm::MMU * newMMU(ETISS_CPU *cpu)
It is an interface to instanciate a Memory Management Unit.
Definition: CPUArch.h:268
virtual std::string getIncludePath()
returns a path that will be used to look up header files
Definition: CPUArch.cpp:150
virtual const std::set< std::string > & getHeaders() const =0
set of code header files e.g.
CPUArch(std::string archname)
Definition: CPUArch.cpp:74
virtual unsigned getMaximumInstructionsPerMetaInstruction()
maximum number of instructions in a meta instruction
Definition: CPUArch.cpp:112
virtual std::string getBlockGlobalCode()
get c++ code snippet that is placed at the top of a translated block
Definition: CPUArch.cpp:107
virtual etiss::plugin::gdb::GDBCore & getGDBCore()
returns arch dependent gdb functions.
Definition: CPUArch.cpp:145
virtual unsigned getInstructionSizeInBytes()=0
size of one instruction/ smalest data unit for instructions of variable length
virtual std::string _getPluginName() const
do not override. maps to getName().
Definition: CPUArch.cpp:155
virtual void deleteInterruptVector(etiss::InterruptVector *vec, ETISS_CPU *cpu)
delete an allocated interrupt vector object
Definition: CPUArch.cpp:132
virtual etiss::InterruptVector * createInterruptVector(ETISS_CPU *cpu)
allocate a new interrupt vector object for the given cpu
Definition: CPUArch.cpp:128
virtual void deleteInterruptEnable(etiss::InterruptEnable *en, ETISS_CPU *cpu)
Definition: CPUArch.cpp:141
std::string getArchName() const
returns the name of this architecture.
Definition: CPUArch.cpp:81
etiss::plugin::gdb::GDBCore gdbcore_
Definition: CPUArch.h:275
virtual bool unlikelyInstruction(etiss::uint8 *instr, unsigned length, bool &ismetainstruction)
return true if the given data is unlikely to be an instruction.
Definition: CPUArch.cpp:86
virtual unsigned getMaximumInstructionSizeInBytes()=0
used for variable instruction size and delay slots
virtual void compensateEndianess(ETISS_CPU *cpu, etiss::instr::BitArray &ba) const
this function should compensate for any endianess on a BitArray so that bit 0 is always the LSB.
Definition: CPUArch.cpp:188
virtual unsigned getSuperInstructionCount()
fixed number of sub instructions per instruction (e.g.
Definition: CPUArch.cpp:118
virtual ETISS_CPU * newCPU()=0
allocate new cpu structure
virtual ~CPUArch()
Definition: CPUArch.cpp:79
virtual void finalizeInstrSet(etiss::instr::ModedInstructionSet &) const
the default behavior of this function of a cpu arch is to add "cpu->cpuTime_ps += cpu->cpuCycleTime_p...
Definition: CPUArch.cpp:181
virtual etiss::int32 handleException(etiss::int32 code, ETISS_CPU *cpu)
translate/process exceptions that occur at runtime
Definition: CPUArch.cpp:123
std::string getName() const
returns the name of this architecture.
Definition: CPUArch.h:184
interface to set interrupt bits
interface class for libraries.
base plugin class that provides access to different plugin functions if present
Definition: Plugin.h:77
allows to add code to the translation of instructions
Definition: Plugin.h:262
stores a bit vector
Definition: Instruction.h:161
holds etiss::instr::VariableInstructionSet instances for different modes.
Definition: Instruction.h:562
provides to architecture dependent registers as defined by gdb
Definition: GDBCore.h:77
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)
basic cpu state structure needed for execution of any cpu architecture.
Definition: CPU.h:89