[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] plugin: extend API with qemu_plugin_tb_size
From: |
Luke Craig |
Subject: |
[PATCH 2/2] plugin: extend API with qemu_plugin_tb_size |
Date: |
Mon, 27 Jan 2025 15:17:34 -0500 |
---
include/qemu/qemu-plugin.h | 10 ++++++++++
plugins/api.c | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index a1c478c54f..1fa656da82 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -476,6 +476,16 @@ void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
QEMU_PLUGIN_API
size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb *tb);
+/**
+ * qemu_plugin_tb_size() - query helper for size of TB
+ * @tb: opaque handle to TB passed to callback
+ *
+ * Returns: size of block in bytes
+ */
+
+QEMU_PLUGIN_API
+size_t qemu_plugin_tb_size(const struct qemu_plugin_tb *tb);
+
/**
* qemu_plugin_tb_vaddr() - query helper for vaddr of TB start
* @tb: opaque handle to TB passed to callback
diff --git a/plugins/api.c b/plugins/api.c
index 7ff5e1c1bd..177f0ac9b6 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -241,6 +241,11 @@ size_t qemu_plugin_tb_n_insns(const struct qemu_plugin_tb
*tb)
return tb->n;
}
+size_t qemu_plugin_tb_size(const struct qemu_plugin_tb *tb){
+ const DisasContextBase *db = tcg_ctx->plugin_db;
+ return db->size;
+}
+
uint64_t qemu_plugin_tb_vaddr(const struct qemu_plugin_tb *tb)
{
const DisasContextBase *db = tcg_ctx->plugin_db;
--
2.34.1