aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorEmilio Cota <cota@braap.org>2023-01-24 18:01:25 +0000
committerAlex Bennée <alex.bennee@linaro.org>2023-02-02 11:48:20 +0000
commit17083f6fa6e02326f1c1e8b67b8b282480d013d2 (patch)
tree436f0872848fe20685b9e04d75f4d4aa1b4c3e5d /tcg
parent0f92d94ae37952ed3e6771bc429de4b739eb6ca3 (diff)
downloadqemu-17083f6fa6e02326f1c1e8b67b8b282480d013d2.zip
qemu-17083f6fa6e02326f1c1e8b67b8b282480d013d2.tar.gz
qemu-17083f6fa6e02326f1c1e8b67b8b282480d013d2.tar.bz2
tcg: exclude non-memory effecting helpers from instrumentation
There are actually a whole bunch of helpers that don't affect memory that we shouldn't instrument. They are helpfully identified by the TCG_CALL_NO_SIDE_EFFECTS flag which marks out lookup_tb_ptr as well as a lot of the maths helpers. To avoid the string compare we introduce a new flag for plugin internals so we skip that too. Related: #1381 Signed-off-by: Emilio Cota <cota@braap.org> Message-Id: <20230108164731.61469-4-cota@braap.org> [AJB: updated to skip all no SE plugins, add flag for plugin helper] Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20230124180127.1881110-34-alex.bennee@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/tcg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index d502327..fd557d5 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1674,8 +1674,10 @@ void tcg_gen_callN(void *func, TCGTemp *ret, int nargs, TCGTemp **args)
op = tcg_op_alloc(INDEX_op_call, total_args);
#ifdef CONFIG_PLUGIN
- /* detect non-plugin helpers */
- if (tcg_ctx->plugin_insn && unlikely(strncmp(info->name, "plugin_", 7))) {
+ /* Flag helpers that may affect guest state */
+ if (tcg_ctx->plugin_insn &&
+ !(info->flags & TCG_CALL_PLUGIN) &&
+ !(info->flags & TCG_CALL_NO_SIDE_EFFECTS)) {
tcg_ctx->plugin_insn->calls_helpers = true;
}
#endif