mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
plugins: add inline operation per vcpu
Extends API with three new functions: qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline_per_vcpu(). Those functions takes a qemu_plugin_u64 as input. This allows to have a thread-safe and type-safe version of inline operations. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20240304130036.124418-5-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240305121005.3528075-18-alex.bennee@linaro.org>
This commit is contained in:
parent
62f92b8d97
commit
0bcebaba45
7 changed files with 126 additions and 2 deletions
|
@ -92,6 +92,7 @@ struct qemu_plugin_dyn_cb {
|
|||
/* fields specific to each dyn_cb type go here */
|
||||
union {
|
||||
struct {
|
||||
qemu_plugin_u64 entry;
|
||||
enum qemu_plugin_op op;
|
||||
uint64_t imm;
|
||||
} inline_insn;
|
||||
|
|
|
@ -328,6 +328,22 @@ void qemu_plugin_register_vcpu_tb_exec_inline(struct qemu_plugin_tb *tb,
|
|||
enum qemu_plugin_op op,
|
||||
void *ptr, uint64_t imm);
|
||||
|
||||
/**
|
||||
* qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu() - execution inline op
|
||||
* @tb: the opaque qemu_plugin_tb handle for the translation
|
||||
* @op: the type of qemu_plugin_op (e.g. ADD_U64)
|
||||
* @entry: entry to run op
|
||||
* @imm: the op data (e.g. 1)
|
||||
*
|
||||
* Insert an inline op on a given scoreboard entry.
|
||||
*/
|
||||
QEMU_PLUGIN_API
|
||||
void qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu(
|
||||
struct qemu_plugin_tb *tb,
|
||||
enum qemu_plugin_op op,
|
||||
qemu_plugin_u64 entry,
|
||||
uint64_t imm);
|
||||
|
||||
/**
|
||||
* qemu_plugin_register_vcpu_insn_exec_cb() - register insn execution cb
|
||||
* @insn: the opaque qemu_plugin_insn handle for an instruction
|
||||
|
@ -358,6 +374,22 @@ void qemu_plugin_register_vcpu_insn_exec_inline(struct qemu_plugin_insn *insn,
|
|||
enum qemu_plugin_op op,
|
||||
void *ptr, uint64_t imm);
|
||||
|
||||
/**
|
||||
* qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu() - insn exec inline op
|
||||
* @insn: the opaque qemu_plugin_insn handle for an instruction
|
||||
* @op: the type of qemu_plugin_op (e.g. ADD_U64)
|
||||
* @entry: entry to run op
|
||||
* @imm: the op data (e.g. 1)
|
||||
*
|
||||
* Insert an inline op to every time an instruction executes.
|
||||
*/
|
||||
QEMU_PLUGIN_API
|
||||
void qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(
|
||||
struct qemu_plugin_insn *insn,
|
||||
enum qemu_plugin_op op,
|
||||
qemu_plugin_u64 entry,
|
||||
uint64_t imm);
|
||||
|
||||
/**
|
||||
* qemu_plugin_tb_n_insns() - query helper for number of insns in TB
|
||||
* @tb: opaque handle to TB passed to callback
|
||||
|
@ -583,7 +615,24 @@ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn,
|
|||
enum qemu_plugin_op op, void *ptr,
|
||||
uint64_t imm);
|
||||
|
||||
|
||||
/**
|
||||
* qemu_plugin_register_vcpu_mem_inline_per_vcpu() - inline op for mem access
|
||||
* @insn: handle for instruction to instrument
|
||||
* @rw: apply to reads, writes or both
|
||||
* @op: the op, of type qemu_plugin_op
|
||||
* @entry: entry to run op
|
||||
* @imm: immediate data for @op
|
||||
*
|
||||
* This registers a inline op every memory access generated by the
|
||||
* instruction.
|
||||
*/
|
||||
QEMU_PLUGIN_API
|
||||
void qemu_plugin_register_vcpu_mem_inline_per_vcpu(
|
||||
struct qemu_plugin_insn *insn,
|
||||
enum qemu_plugin_mem_rw rw,
|
||||
enum qemu_plugin_op op,
|
||||
qemu_plugin_u64 entry,
|
||||
uint64_t imm);
|
||||
|
||||
typedef void
|
||||
(*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue