ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
#include <Translation.h>
Public Member Functions | |
Translation (std::shared_ptr< etiss::CPUArch > &arch, std::shared_ptr< etiss::JIT > &jit, std::list< std::shared_ptr< etiss::Plugin >> &plugins, ETISS_System &system, ETISS_CPU &cpu) | |
~Translation () | |
void ** | init () |
BlockLink * | getBlockFast (BlockLink *prev, const etiss::uint64 &instructionindex) |
CALL THIS function NOT getBlock(...) since getBlock will not check next/branch references. More... | |
BlockLink * | getBlock (BlockLink *prev, const etiss::uint64 &instructionindex) |
etiss::int32 | translateBlock (CodeBlock &cb) |
void | unloadBlocksAll () |
void | unloadBlocks (etiss::uint64 startindex=0, etiss::uint64 endindex=((etiss::uint64)((etiss::int64) -1))) |
std::string | disasm (uint8_t *buf, unsigned len, int &append) |
Private Attributes | |
std::shared_ptr< etiss::CPUArch > & | archptr_ |
std::shared_ptr< etiss::JIT > & | jitptr_ |
etiss::CPUArch *const | arch_ |
etiss::JIT *const | jit_ |
std::list< std::shared_ptr< etiss::Plugin > > & | plugins_ |
ETISS_System & | system_ |
ETISS_CPU & | cpu_ |
etiss::TranslationPlugin ** | plugins_array_ |
void ** | plugins_handle_array_ |
size_t | plugins_array_size_ |
void(* | plugins_initCodeBlock_ )(etiss::TranslationPlugin **, CodeBlock &) |
Function pointer, the function is getting defined in Translation::init via template function etiss::call_initCodeBlock It calls the TranslationPlugin::initCodeBlock functions of all translation plugins. More... | |
void(* | plugins_finalizeCodeBlock_ )(etiss::TranslationPlugin **, CodeBlock &) |
Function pointer, the function is getting defined in Translation::init via template function etiss::call_finalizeCodeBlock It calls the TranslationPlugin::finalizeCodeBlock functions of all translation plugins. More... | |
etiss::instr::ModedInstructionSet * | mis_ |
std::unordered_map< etiss::uint64, std::list< BlockLink * > > | blockmap_ |
const uint64_t | id |
unique id used to generate unique function names across translation instances More... | |
uint64_t | tblockcount |
countes translated blocks. needed to guarantee unique block function names More... | |
Definition at line 121 of file Translation.h.
etiss::Translation::Translation | ( | std::shared_ptr< etiss::CPUArch > & | arch, |
std::shared_ptr< etiss::JIT > & | jit, | ||
std::list< std::shared_ptr< etiss::Plugin >> & | plugins, | ||
ETISS_System & | system, | ||
ETISS_CPU & | cpu | ||
) |
Definition at line 117 of file Translation.cpp.
References tblockcount.
etiss::Translation::~Translation | ( | ) |
Definition at line 139 of file Translation.cpp.
References mis_, plugins_array_, plugins_handle_array_, uint64_t, and unloadBlocks().
Definition at line 658 of file Translation.cpp.
References cpu_, etiss::instr::Buffer::data(), etiss::instr::ModedInstructionSet::get(), etiss::instr::VariableInstructionSet::get(), etiss::instr::BitArray::intCount(), etiss::instr::Buffer::internalBuffer(), memcpy(), mis_, ETISS_CPU::mode, etiss::instr::Instruction::printASM(), etiss::instr::InstructionSet::resolve(), and etiss::instr::BitArray::set_value().
BlockLink * etiss::Translation::getBlock | ( | BlockLink * | prev, |
const etiss::uint64 & | instructionindex | ||
) |
Definition at line 263 of file Translation.cpp.
References arch_, blockmap_, etiss::BlockLink::branch, etiss::cfg(), cpu_, etiss::BlockLink::decrRef(), etiss::BlockLink::end, etiss::CodeBlock::endaddress_, etiss::ERROR, ETISS_DEBUG, etiss::CodeBlock::fileglobalCode(), etiss::CodeBlock::functionglobalCode(), etiss::JIT::getFunction(), etiss::CPUArch::getIncludePath(), etiss::BlockLink::incrRef(), jit_, etiss::jitExtHeaderPaths(), etiss::jitExtHeaders(), etiss::jitExtLibPaths(), etiss::jitExtLibraries(), etiss::jitFiles(), etiss::log(), ETISS_CPU::mode, etiss::BlockLink::next, plugins_array_, plugins_finalizeCodeBlock_, plugins_initCodeBlock_, etiss::BlockLink::start, etiss::CodeBlock::startindex_, tblockcount, etiss::CodeBlock::toCode(), etiss::toString(), etiss::JIT::translate(), translateBlock(), etiss::BlockLink::updateRef(), and etiss::BlockLink::valid.
Referenced by getBlockFast().
|
inline |
CALL THIS function NOT getBlock(...) since getBlock will not check next/branch references.
Definition at line 165 of file Translation.h.
References etiss::BlockLink::branch, etiss::BlockLink::end, getBlock(), etiss::BlockLink::next, etiss::BlockLink::start, etiss::BlockLink::updateRef(), and etiss::BlockLink::valid.
Referenced by etiss::CPUCore::execute().
void ** etiss::Translation::init | ( | ) |
TODO verify instructions, add an error message here
Definition at line 147 of file Translation.cpp.
References arch_, etiss::call_finalizeCodeBlock_ul(), etiss::call_initCodeBlock_ul(), etiss::instr::ModedInstructionSet::compile(), etiss::ERROR, etiss::TranslationPlugin::finalizeInstrSet(), etiss::CPUArch::getName(), etiss::TranslationPlugin::getPluginHandle(), etiss::Plugin::getTranslationPlugin(), etiss::TranslationPlugin::initInstrSet(), jit_, etiss::log(), mis_, plugins_, plugins_array_, plugins_array_size_, plugins_finalizeCodeBlock_, plugins_handle_array_, plugins_initCodeBlock_, etiss::TranslationPlugin::pointerCode, and etiss::toString().
Referenced by etiss::CPUCore::execute().
etiss::int32 etiss::Translation::translateBlock | ( | CodeBlock & | cb | ) |
Definition at line 452 of file Translation.cpp.
References etiss::CodeBlock::append(), arch_, Buffer, etiss::instr::BitArray::byteCount(), etiss::instr::InstructionContext::cf_delay_slot_, etiss::cfg(), etiss::CPUArch::compensateEndianess(), cpu_, etiss::instr::InstructionContext::current_address_, etiss::instr::InstructionContext::current_local_address_, etiss::instr::Buffer::data(), ETISS_System::dbg_read, etiss::CodeBlock::endaddress_, etiss::instr::InstructionContext::force_append_next_instr_, etiss::instr::InstructionContext::force_block_end_, etiss::Configuration::get(), etiss::instr::ModedInstructionSet::get(), etiss::instr::VariableInstructionSet::get(), etiss::CodeBlock::Line::getCodeSet(), etiss::instr::InstructionSet::getInvalid(), etiss::instr::VariableInstructionSet::getMain(), ETISS_System::handle, etiss::instr::InstructionContext::instr_width_, etiss::instr::InstructionContext::instr_width_fully_evaluated_, etiss::instr::BitArray::intCount(), etiss::instr::Buffer::internalBuffer(), etiss::instr::InstructionContext::is_not_default_width_, etiss::instr::VariableInstructionSet::length_updater_, mis_, ETISS_CPU::mode, etiss::mm::NOERROR, etiss::CodeBlock::reserve(), etiss::instr::InstructionSet::resolve(), etiss::instr::BitArray::set_value(), etiss::CodeBlock::startindex_, system_, etiss::instr::Instruction::translate(), unlikely, and etiss::instr::VariableInstructionSet::width_.
Referenced by getBlock().
void etiss::Translation::unloadBlocks | ( | etiss::uint64 | startindex = 0 , |
etiss::uint64 | endindex = ((etiss::uint64)((etiss::int64)-1)) |
||
) |
Definition at line 618 of file Translation.cpp.
References blockmap_, etiss::BlockLink::branch, etiss::BlockLink::decrRef(), etiss::BlockLink::end, etiss::BlockLink::next, etiss::BlockLink::start, unloadBlocksAll(), etiss::BlockLink::updateRef(), and etiss::BlockLink::valid.
Referenced by etiss_CPUCore_handleException(), and ~Translation().
void etiss::Translation::unloadBlocksAll | ( | ) |
Definition at line 600 of file Translation.cpp.
References blockmap_.
Referenced by unloadBlocks().
|
private |
Definition at line 126 of file Translation.h.
Referenced by getBlock(), init(), and translateBlock().
|
private |
Definition at line 124 of file Translation.h.
|
private |
Definition at line 150 of file Translation.h.
Referenced by getBlock(), unloadBlocks(), and unloadBlocksAll().
|
private |
Definition at line 130 of file Translation.h.
Referenced by disasm(), getBlock(), and translateBlock().
|
private |
unique id used to generate unique function names across translation instances
Definition at line 220 of file Translation.h.
|
private |
Definition at line 127 of file Translation.h.
Referenced by getBlock(), and init().
|
private |
Definition at line 125 of file Translation.h.
|
private |
Definition at line 148 of file Translation.h.
Referenced by disasm(), init(), translateBlock(), and ~Translation().
|
private |
Definition at line 128 of file Translation.h.
Referenced by init().
|
private |
Definition at line 131 of file Translation.h.
Referenced by getBlock(), init(), and ~Translation().
|
private |
Definition at line 133 of file Translation.h.
Referenced by init().
|
private |
Function pointer, the function is getting defined in Translation::init via template function etiss::call_finalizeCodeBlock It calls the TranslationPlugin::finalizeCodeBlock functions of all translation plugins.
Definition at line 146 of file Translation.h.
Referenced by getBlock(), and init().
|
private |
Definition at line 132 of file Translation.h.
Referenced by init(), and ~Translation().
|
private |
Function pointer, the function is getting defined in Translation::init via template function etiss::call_initCodeBlock It calls the TranslationPlugin::initCodeBlock functions of all translation plugins.
Definition at line 140 of file Translation.h.
Referenced by getBlock(), and init().
|
private |
Definition at line 129 of file Translation.h.
Referenced by translateBlock().
|
private |
countes translated blocks. needed to guarantee unique block function names
Definition at line 222 of file Translation.h.
Referenced by getBlock(), and Translation().