ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
etiss::TranslationPlugin Class Reference

allows to add code to the translation of instructions More...

#include <Plugin.h>

Inheritance diagram for etiss::TranslationPlugin:
Inheritance graph
[legend]
Collaboration diagram for etiss::TranslationPlugin:
Collaboration graph
[legend]

Public Member Functions

 TranslationPlugin ()
 
virtual ~TranslationPlugin ()
 
virtual void initInstrSet (etiss::instr::ModedInstructionSet &) const
 called to add instructions to the instruction set More...
 
virtual void finalizeInstrSet (etiss::instr::ModedInstructionSet &) const
 called after all instructions have been added to allow last changes More...
 
virtual void initCodeBlock (etiss::CodeBlock &) const
 called before instructions are translated for the code block More...
 
virtual void finalizeCodeBlock (etiss::CodeBlock &) const
 called after all instructions have been translated for the code block More...
 
virtual void * getPluginHandle ()
 called to get the handle that is available in translated code via getPoinerCode(). [default: this] More...
 
- Public Member Functions inherited from etiss::Plugin
virtual ~Plugin ()
 
unsigned getType ()
 
InterruptListenerPlugingetInterruptListenerPlugin ()
 
CoroutinePlugingetCoroutinePlugin ()
 
SystemWrapperPlugingetSystemWrapperPlugin ()
 
RegisterDevicePlugingetRegisterDevicePlugin ()
 
TranslationPlugingetTranslationPlugin ()
 
std::string getPluginName () const
 
const std::string & getLastAssignedCoreName ()
 
std::string toString () const
 
- Public Member Functions inherited from etiss::ToString
 ToString ()
 
virtual ~ToString ()
 

Protected Member Functions

std::string getPointerCode () const
 returns a C code expression that allows to get or assign a pointer to the variable assigned to this translation plugin. More...
 
- Protected Member Functions inherited from etiss::Plugin
 Plugin (unsigned type=0)
 
virtual std::string _getPluginName () const =0
 
virtual void init (ETISS_CPU *cpu, ETISS_System *system, CPUArch *arch)
 this function is called before the plugin is used in the cpu execution loop (etiss::CPUCore::execute). More...
 
virtual void cleanup ()
 this function is called after cpu execution loop (etiss::CPUCore::execute) finished. More...
 
void setCorrespondingCPUCoreName (std::string name)
 
virtual void addedToCPUCore (etiss::CPUCore *core)
 called as soon a plugin has been added to its CPUCore. More...
 
virtual void removedFromCPUCore (etiss::CPUCore *core)
 called as soon a plugin has been removed from its CPUCore. More...
 

Private Attributes

std::string pointerCode
 

Friends

class etiss::Translation
 

Additional Inherited Members

- Static Public Attributes inherited from etiss::Plugin
static const unsigned INTERRUPTLISTENER = 1 << 0
 access to translated code More...
 
static const unsigned COROUTINE = 1 << 1
 callback after execution of each translated block More...
 
static const unsigned SYSTEMWRAPPER = 1 << 2
 can wrap/change ETISS_System structure at execution start More...
 
static const unsigned REGISTERDEVICE
 gets noticed of changes to special registers (e.g. mmu register etc. [depends on architecture]) More...
 
static const unsigned TRANSLATION
 access to translated code during translation phase or when instruction tree is built More...
 
- Protected Attributes inherited from etiss::Plugin
ETISS_CPUplugin_cpu_
 holds a pointer to the cpu structure. will be set before init call and after cleanup call More...
 
ETISS_Systemplugin_system_
 holds a pointer to the system structure. More...
 
CPUArchplugin_arch_
 holds a pointer to the CPUArch instance. will be set before init call and after cleanup call More...
 
CPUCoreplugin_core_
 holds a pointer to the associated CPUCore instance. More...
 

Detailed Description

allows to add code to the translation of instructions

There can be one member variable used. During translation a pointer of type void, which can be cast to any type, to the member variable can be obtained by the code returned by ::getPointerCode() as string

This code accesses the variable plugin_pointers in the translated code, which is a parameter that holds the a list of "this pointers" to all translation plugins, it seems the "this pointers" always point to the member variable (???)

The function ::TranslationPlugin::getPluginHandle returns the "this pointer", It is used in Translation::init to fill the list of all translation plugins

Definition at line 261 of file Plugin.h.

Constructor & Destructor Documentation

◆ TranslationPlugin()

TranslationPlugin::TranslationPlugin ( )

◆ ~TranslationPlugin()

TranslationPlugin::~TranslationPlugin ( )
virtual

Definition at line 90 of file Plugin.cpp.

Member Function Documentation

◆ finalizeCodeBlock()

void TranslationPlugin::finalizeCodeBlock ( etiss::CodeBlock ) const
virtual

called after all instructions have been translated for the code block

Reimplemented in etiss::plugin::gdb::Server.

Definition at line 94 of file Plugin.cpp.

Referenced by etiss::call_finalizeCodeBlock(), and etiss::call_finalizeCodeBlock_ul().

Here is the caller graph for this function:

◆ finalizeInstrSet()

void TranslationPlugin::finalizeInstrSet ( etiss::instr::ModedInstructionSet ) const
virtual

called after all instructions have been added to allow last changes

Reimplemented in etiss::plugin::gdb::Server, etiss::plugin::VariableValueLogger, etiss::plugin::PrintInstruction, etiss::plugin::InstructionSpecificAddressCallback, etiss::plugin::InstructionAccurateCallback, and etiss::CPUArch.

Definition at line 92 of file Plugin.cpp.

Referenced by etiss::Translation::init().

Here is the caller graph for this function:

◆ getPluginHandle()

void * TranslationPlugin::getPluginHandle ( )
virtual

called to get the handle that is available in translated code via getPoinerCode(). [default: this]

Reimplemented in etiss::plugin::gdb::Server, etiss::plugin::PrintInstruction, and etiss::plugin::InstructionSpecificAddressCallback.

Definition at line 96 of file Plugin.cpp.

Referenced by etiss::Translation::init().

Here is the caller graph for this function:

◆ getPointerCode()

std::string TranslationPlugin::getPointerCode ( ) const
protected

returns a C code expression that allows to get or assign a pointer to the variable assigned to this translation plugin.

this function may only be called from within member functions of this class pointerCode is set in Translation::init

Definition at line 101 of file Plugin.cpp.

References pointerCode.

Referenced by etiss::plugin::InstructionAccurateCallback::finalizeInstrSet(), etiss::plugin::InstructionSpecificAddressCallback::finalizeInstrSet(), etiss::plugin::VariableValueLogger::finalizeInstrSet(), etiss::plugin::gdb::Server::finalizeInstrSet(), and etiss::plugin::InstructionSpecificAddressCallback::initCodeBlock().

Here is the caller graph for this function:

◆ initCodeBlock()

void TranslationPlugin::initCodeBlock ( etiss::CodeBlock ) const
virtual

called before instructions are translated for the code block

Reimplemented in RV64IMACFDArch, RV32IMACFDArch, etiss::plugin::VariableValueLogger, etiss::plugin::PrintInstruction, etiss::plugin::InstructionSpecificAddressCallback, and etiss::plugin::InstructionAccurateCallback.

Definition at line 93 of file Plugin.cpp.

Referenced by etiss::call_initCodeBlock(), and etiss::call_initCodeBlock_ul().

Here is the caller graph for this function:

◆ initInstrSet()

void TranslationPlugin::initInstrSet ( etiss::instr::ModedInstructionSet ) const
virtual

called to add instructions to the instruction set

Reimplemented in etiss::DataSheetAccurateTiming, RV64IMACFDArch, and RV32IMACFDArch.

Definition at line 91 of file Plugin.cpp.

Referenced by etiss::Translation::init().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ etiss::Translation

friend class etiss::Translation
friend

Definition at line 263 of file Plugin.h.

Member Data Documentation

◆ pointerCode

std::string etiss::TranslationPlugin::pointerCode
private

Definition at line 288 of file Plugin.h.

Referenced by getPointerCode(), and etiss::Translation::init().


The documentation for this class was generated from the following files: