43#ifndef ETISS_INCLUDE_TRANSLATION_H
44#define ETISS_INCLUDE_TRANSLATION_H
52#include <unordered_map>
66 const etiss::uint64
end;
101 if (link == newValue)
113 if (
likely(newValue != 0))
128 std::list<std::shared_ptr<etiss::Plugin>> &
plugins_;
150 std::unordered_map<etiss::uint64, std::list<BlockLink *>>
blockmap_;
151#if ETISS_TRANSLATOR_STAT
152 etiss::uint64 next_count_;
153 etiss::uint64 branch_count_;
154 etiss::uint64 miss_count_;
157 Translation(std::shared_ptr<etiss::CPUArch> &arch, std::shared_ptr<etiss::JIT> &jit,
170 if (instructionindex >= prev->
end && bl != 0 && bl->
end > instructionindex)
175#if ETISS_TRANSLATOR_STAT
186 if (bl != 0 && bl->
start <= instructionindex && bl->
end > instructionindex)
191#if ETISS_TRANSLATOR_STAT
202#if ETISS_TRANSLATOR_STAT
205 return getBlock(prev, instructionindex);
214 void unloadBlocks(etiss::uint64 startindex = 0, etiss::uint64 endindex = ((etiss::uint64)((etiss::int64)-1)));
contains neccesary interfaces for instruction translation.
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...
JIT compiler interface definition.
static __inline__ uint64_t
static __inline__ uint8_t
structure to store additional information with a function pointer to the translated code
static void updateRef(BlockLink *&link, BlockLink *newValue)
change the value of a BlockLink pointer.
const etiss::uint64 end
end instruction index (excluded)
BlockLink * next
next block; ONLY MODIFY WITH updateRef
unsigned refcount
number of references to this instance; DO NOT MODIFY
const etiss::uint64 start
start instruction index
const std::shared_ptr< void > jitlib
library of the associated function
static void decrRef(BlockLink *&link)
decrease reference count to a BlockLink and delete the instance if no other references exist
BlockLink * branch
last branch block; ONLY MODIFY WITH updateRef
const ExecBlockCall execBlock
function pointer
bool valid
true if the associated function implements current code
static void incrRef(BlockLink *link)
increase reference count to a BlockLink
the interface to translate instructions of and processor architecture
compiler interface for just in time compilation of generated C code
allows to add code to the translation of instructions
std::string disasm(uint8_t *buf, unsigned len, int &append)
etiss::instr::ModedInstructionSet * mis_
uint64_t tblockcount
countes translated blocks. needed to guarantee unique block function names
std::list< std::shared_ptr< etiss::Plugin > > & plugins_
size_t plugins_array_size_
etiss::TranslationPlugin ** plugins_array_
void unloadBlocks(etiss::uint64 startindex=0, etiss::uint64 endindex=((etiss::uint64)((etiss::int64) -1)))
etiss::CPUArch *const arch_
BlockLink * getBlockFast(BlockLink *prev, const etiss::uint64 &instructionindex)
CALL THIS function NOT getBlock(...) since getBlock will not check next/branch references.
void ** plugins_handle_array_
std::unordered_map< etiss::uint64, std::list< BlockLink * > > blockmap_
std::shared_ptr< etiss::CPUArch > & archptr_
const uint64_t id
unique id used to generate unique function names across translation instances
etiss::int32 translateBlock(CodeBlock &cb)
void(* plugins_finalizeCodeBlock_)(etiss::TranslationPlugin **, CodeBlock &)
Function pointer, the function is getting defined in Translation::init via template function etiss::c...
BlockLink * getBlock(BlockLink *prev, const etiss::uint64 &instructionindex)
void(* plugins_initCodeBlock_)(etiss::TranslationPlugin **, CodeBlock &)
Function pointer, the function is getting defined in Translation::init via template function etiss::c...
std::shared_ptr< etiss::JIT > & jitptr_
holds etiss::instr::VariableInstructionSet instances for different modes.
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
etiss::int32(* ExecBlockCall)(ETISS_CPU *cpu, ETISS_System *system, void **plugin_pointers)
basic cpu state structure needed for execution of any cpu architecture.
memory access and time synchronization functions.