From fb48ce4fbbdd9706bdacd81ad5a428824aa89444 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Wed, 20 May 2026 15:58:10 +0200 Subject: [PATCH 1/3] adds a callback for each time that the vm gets started This is implemented for interp backend only --- src/iss/interp/vm_base.h | 4 ++++ src/iss/vm_plugin.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/iss/interp/vm_base.h b/src/iss/interp/vm_base.h index 337e7dc..5e4f671 100644 --- a/src/iss/interp/vm_base.h +++ b/src/iss/interp/vm_base.h @@ -122,6 +122,8 @@ template class vm_base : public debugger_if, public vm_if { } int start(uint64_t count = std::numeric_limits::max(), bool dump = false, finish_cond_e cond = finish_cond_e::ICOUNT_LIMIT | finish_cond_e::JUMP_TO_SELF) override { + for(const auto& plugin_entry : plugins) + plugin_entry.plugin.execution_start_callback(); int error = 0; auto start = std::chrono::high_resolution_clock::now(); virt_addr_t pc(iss::access_type::FETCH, arch::traits::MEM, get_reg(arch::traits::PC)); @@ -190,6 +192,7 @@ template class vm_base : public debugger_if, public vm_if { if(sync & POST_SYNC) post_plugins.push_back(plugin_entry{plugin}); sync_exec |= sync; + plugins.push_back({plugin}); } } @@ -238,6 +241,7 @@ template class vm_base : public debugger_if, public vm_if { // non-owning pointers // std::vector loaded_regs{arch::traits::NUM_REGS, nullptr}; iss::debugger::target_adapter_base* tgt_adapter{nullptr}; + std::vector plugins; std::vector pre_plugins; std::vector post_plugins; std::vector illegal_cb_plugins; diff --git a/src/iss/vm_plugin.h b/src/iss/vm_plugin.h index e3c3e5e..ccb978d 100644 --- a/src/iss/vm_plugin.h +++ b/src/iss/vm_plugin.h @@ -64,6 +64,8 @@ class vm_plugin { // @suppress("Class has a virtual method and non-virtual destr virtual sync_type get_sync() = 0; virtual void callback(instr_info_t) = 0; + + virtual void execution_start_callback(){}; }; } // namespace iss From 752b9d676648ed6294313bdc10537428e3869b0f Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Wed, 3 Jun 2026 13:49:02 +0200 Subject: [PATCH 2/3] adds get_core_id to iif --- src/iss/instrumentation_if.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/iss/instrumentation_if.h b/src/iss/instrumentation_if.h index f576ead..bfa7fd9 100644 --- a/src/iss/instrumentation_if.h +++ b/src/iss/instrumentation_if.h @@ -177,6 +177,12 @@ struct instrumentation_if { * @return unordered map containing symbol name as key */ virtual std::unordered_map const& get_symbol_table(std::string name) = 0; + /** + * get the core id + * + * @return core id + */ + virtual unsigned get_core_id() = 0; }; } // namespace v2 } /* namespace iss */ From 634fee587d8db9542ba941197db0528b23784a22 Mon Sep 17 00:00:00 2001 From: Eyck-Alexander Jentzsch Date: Fri, 5 Jun 2026 18:31:38 +0200 Subject: [PATCH 3/3] adds default get_core_id --- src/iss/instrumentation_if.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iss/instrumentation_if.h b/src/iss/instrumentation_if.h index bfa7fd9..680e0d9 100644 --- a/src/iss/instrumentation_if.h +++ b/src/iss/instrumentation_if.h @@ -182,7 +182,7 @@ struct instrumentation_if { * * @return core id */ - virtual unsigned get_core_id() = 0; + virtual unsigned get_core_id() { return 0; }; }; } // namespace v2 } /* namespace iss */