diff mbox series

accel/tcg/plugin: Fix op_rw

Message ID 20221121203906.64404-1-richard.henderson@linaro.org
State New
Headers show
Series accel/tcg/plugin: Fix op_rw | expand

Commit Message

Richard Henderson Nov. 21, 2022, 8:39 p.m. UTC
The value of op->args[2] is enum qemu_plugin_mem_rw, which
is already 1-based.  Adding 1 produces incorrect results
for QEMU_PLUGIN_MEM_W and QEMU_PLUGIN_MEM_RW.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 accel/tcg/plugin-gen.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Richard Henderson Dec. 18, 2022, 5:32 p.m. UTC | #1
Ping.

r~

On 11/21/22 12:39, Richard Henderson wrote:
> The value of op->args[2] is enum qemu_plugin_mem_rw, which
> is already 1-based.  Adding 1 produces incorrect results
> for QEMU_PLUGIN_MEM_W and QEMU_PLUGIN_MEM_RW.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   accel/tcg/plugin-gen.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
> index c7d6514840..cd9cee1f5d 100644
> --- a/accel/tcg/plugin-gen.c
> +++ b/accel/tcg/plugin-gen.c
> @@ -495,10 +495,7 @@ static bool op_ok(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
>   
>   static bool op_rw(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
>   {
> -    int w;
> -
> -    w = op->args[2];
> -    return !!(cb->rw & (w + 1));
> +    return cb->rw & op->args[2];
>   }
>   
>   static void inject_cb_type(const GArray *cbs, TCGOp *begin_op,
Alex Bennée Dec. 18, 2022, 7:28 p.m. UTC | #2
Richard Henderson <richard.henderson@linaro.org> writes:

> The value of op->args[2] is enum qemu_plugin_mem_rw, which
> is already 1-based.  Adding 1 produces incorrect results
> for QEMU_PLUGIN_MEM_W and QEMU_PLUGIN_MEM_RW.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
diff mbox series

Patch

diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c
index c7d6514840..cd9cee1f5d 100644
--- a/accel/tcg/plugin-gen.c
+++ b/accel/tcg/plugin-gen.c
@@ -495,10 +495,7 @@  static bool op_ok(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
 
 static bool op_rw(const TCGOp *op, const struct qemu_plugin_dyn_cb *cb)
 {
-    int w;
-
-    w = op->args[2];
-    return !!(cb->rw & (w + 1));
+    return cb->rw & op->args[2];
 }
 
 static void inject_cb_type(const GArray *cbs, TCGOp *begin_op,