ETISS 0.11.2
ExtendableTranslatingInstructionSetSimulator(version0.11.2)
Loading...
Searching...
No Matches
InstructionSpecificAddressCallback.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// This file is part of ETISS. It is licensed under the BSD 3-Clause License; you may not use this file except in
4// compliance with the License. You should have received a copy of the license along with this project. If not, see the
5// LICENSE file.
14#ifndef ETISS_PLUGIN_InstructionSpecificAddressCallback_H_
15#define ETISS_PLUGIN_InstructionSpecificAddressCallback_H_
16
17#include "etiss/Misc.h"
18#include "etiss/Plugin.h"
19
20namespace etiss
21{
22
23namespace plugin
24{
25
30{
31 size_t get_uid_once(void) const
32 {
33 static size_t __uid_cntr{ 0 };
34 return ++__uid_cntr;
35 }
36 size_t const uid_;
37
38 public:
39 struct Data
40 {
41 uint32_t state_; // must be first field to allow pointer cast to uint32_t* for direct acess; the state is
42 // increased whenever a change is made
43 void *this_;
44 };
45
46 private:
48 std::set<uint64_t> caddrset_;
49
50 public:
54 virtual bool callback() = 0; // return values indicates if the block should be stopt with execution
55
58 inline virtual bool callbackOnInstruction(etiss::instr::Instruction &instr) const { return false; }
59
62 inline virtual void addCallbackAddress(uint64_t addr)
63 {
64 caddrset_.insert(addr);
65 pluginData_.state_++; // Force Rewriting of Code Block
66 }
67 inline virtual void removeCallbackAddress(uint64_t addr)
68 {
69 caddrset_.erase(addr);
70 pluginData_.state_++; // Force Rewriting of Code Block
71 }
72
73 inline const std::set<uint64_t> &callbackAddresses() const { return caddrset_; }
74
76 virtual void initCodeBlock(etiss::CodeBlock &block) const;
77 virtual std::string _getPluginName() const;
78 virtual void *getPluginHandle();
79};
80
81} // namespace plugin
82
83} // namespace etiss
84
85#endif
general configuration and logging
plugins for extensions to code translation and instruction execution
static __inline__ uint32_t
Definition arm_cde.h:25
static __inline__ uint64_t
Definition arm_cde.h:31
A list of CodeSets.
Definition CodePart.h:532
allows to add code to the translation of instructions
Definition Plugin.h:222
holds information and translation callbacks for an instruction.
holds etiss::instr::VariableInstructionSet instances for different modes.
a simple plugin that prints the instruction and address when an instruction is executed
virtual void addCallbackAddress(uint64_t addr)
call to add an address at which callback should be called upon execution.
virtual void initCodeBlock(etiss::CodeBlock &block) const
called before instructions are translated for the code block
virtual void finalizeInstrSet(etiss::instr::ModedInstructionSet &) const
called after all instructions have been added to allow last changes
virtual void * getPluginHandle()
called to get the handle that is available in translated code via getPoinerCode()....
virtual bool callback()=0
implement this callback to manipulate the cpu be fore executing the defined instructions at the defin...
virtual bool callbackOnInstruction(etiss::instr::Instruction &instr) const
implement to return true to call InstructionSpecificAddressCallback::callback whenever that etiss::in...
forwards: include/jit/*
Definition Benchmark.h:17