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

#include <Translation.h>

Collaboration diagram for etiss::Translation:
Collaboration graph
[legend]

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 ()
 
BlockLinkgetBlockFast (BlockLink *prev, const etiss::uint64 &instructionindex)
 CALL THIS function NOT getBlock(...) since getBlock will not check next/branch references. More...
 
BlockLinkgetBlock (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_Systemsystem_
 
ETISS_CPUcpu_
 
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::ModedInstructionSetmis_
 
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...
 

Detailed Description

Definition at line 121 of file Translation.h.

Constructor & Destructor Documentation

◆ Translation()

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.

◆ ~Translation()

etiss::Translation::~Translation ( )

Definition at line 139 of file Translation.cpp.

References mis_, plugins_array_, plugins_handle_array_, uint64_t, and unloadBlocks().

Here is the call graph for this function:

Member Function Documentation

◆ disasm()

std::string etiss::Translation::disasm ( uint8_t buf,
unsigned  len,
int append 
)

◆ getBlock()

BlockLink * etiss::Translation::getBlock ( BlockLink prev,
const etiss::uint64 instructionindex 
)

◆ getBlockFast()

BlockLink* etiss::Translation::getBlockFast ( BlockLink prev,
const etiss::uint64 instructionindex 
)
inline

CALL THIS function NOT getBlock(...) since getBlock will not check next/branch references.

Returns
a reference to a block containing the instruction index if it is referenced by the current block

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void ** etiss::Translation::init ( )

◆ translateBlock()

etiss::int32 etiss::Translation::translateBlock ( CodeBlock cb)
Note
this function only does the instruction to C code translation. compilation (C code to function pointer) is done in getBlock()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadBlocks()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadBlocksAll()

void etiss::Translation::unloadBlocksAll ( )

Definition at line 600 of file Translation.cpp.

References blockmap_.

Referenced by unloadBlocks().

Here is the caller graph for this function:

Member Data Documentation

◆ arch_

etiss::CPUArch* const etiss::Translation::arch_
private

Definition at line 126 of file Translation.h.

Referenced by getBlock(), init(), and translateBlock().

◆ archptr_

std::shared_ptr<etiss::CPUArch>& etiss::Translation::archptr_
private

Definition at line 124 of file Translation.h.

◆ blockmap_

std::unordered_map<etiss::uint64, std::list<BlockLink *> > etiss::Translation::blockmap_
private

Definition at line 150 of file Translation.h.

Referenced by getBlock(), unloadBlocks(), and unloadBlocksAll().

◆ cpu_

ETISS_CPU& etiss::Translation::cpu_
private

Definition at line 130 of file Translation.h.

Referenced by disasm(), getBlock(), and translateBlock().

◆ id

const uint64_t etiss::Translation::id
private

unique id used to generate unique function names across translation instances

Definition at line 220 of file Translation.h.

◆ jit_

etiss::JIT* const etiss::Translation::jit_
private

Definition at line 127 of file Translation.h.

Referenced by getBlock(), and init().

◆ jitptr_

std::shared_ptr<etiss::JIT>& etiss::Translation::jitptr_
private

Definition at line 125 of file Translation.h.

◆ mis_

etiss::instr::ModedInstructionSet* etiss::Translation::mis_
private

Definition at line 148 of file Translation.h.

Referenced by disasm(), init(), translateBlock(), and ~Translation().

◆ plugins_

std::list<std::shared_ptr<etiss::Plugin> >& etiss::Translation::plugins_
private

Definition at line 128 of file Translation.h.

Referenced by init().

◆ plugins_array_

etiss::TranslationPlugin** etiss::Translation::plugins_array_
private

Definition at line 131 of file Translation.h.

Referenced by getBlock(), init(), and ~Translation().

◆ plugins_array_size_

size_t etiss::Translation::plugins_array_size_
private

Definition at line 133 of file Translation.h.

Referenced by init().

◆ plugins_finalizeCodeBlock_

void(* etiss::Translation::plugins_finalizeCodeBlock_) (etiss::TranslationPlugin **, CodeBlock &)
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().

◆ plugins_handle_array_

void** etiss::Translation::plugins_handle_array_
private

Definition at line 132 of file Translation.h.

Referenced by init(), and ~Translation().

◆ plugins_initCodeBlock_

void(* etiss::Translation::plugins_initCodeBlock_) (etiss::TranslationPlugin **, CodeBlock &)
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().

◆ system_

ETISS_System& etiss::Translation::system_
private

Definition at line 129 of file Translation.h.

Referenced by translateBlock().

◆ tblockcount

uint64_t etiss::Translation::tblockcount
private

countes translated blocks. needed to guarantee unique block function names

Definition at line 222 of file Translation.h.

Referenced by getBlock(), and Translation().


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