qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 23/48] translator: add plugin_insn argument to tra


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC 23/48] translator: add plugin_insn argument to translate_insn
Date: Mon, 26 Nov 2018 14:52:12 +0000
User-agent: mu4e 1.1.0; emacs 26.1.90

Emilio G. Cota <address@hidden> writes:

> Signed-off-by: Emilio G. Cota <address@hidden>
> ---
>  include/exec/translator.h   | 4 +++-
>  accel/tcg/translator.c      | 4 ++--
>  target/alpha/translate.c    | 3 ++-
>  target/arm/translate-a64.c  | 3 ++-
>  target/arm/translate.c      | 6 ++++--
>  target/hppa/translate.c     | 3 ++-
>  target/i386/translate.c     | 3 ++-
>  target/m68k/translate.c     | 3 ++-
>  target/mips/translate.c     | 3 ++-
>  target/openrisc/translate.c | 3 ++-
>  target/ppc/translate.c      | 3 ++-
>  target/riscv/translate.c    | 3 ++-
>  target/s390x/translate.c    | 3 ++-
>  target/sh4/translate.c      | 3 ++-
>  target/sparc/translate.c    | 3 ++-
>  target/xtensa/translate.c   | 3 ++-
>  16 files changed, 35 insertions(+), 18 deletions(-)
>
> diff --git a/include/exec/translator.h b/include/exec/translator.h
> index 71e7b2c347..a28147b3dd 100644
> --- a/include/exec/translator.h
> +++ b/include/exec/translator.h
> @@ -20,6 +20,7 @@
>
>
>  #include "exec/exec-all.h"
> +#include "qemu/plugin.h"
>  #include "tcg/tcg.h"
>
>
> @@ -112,7 +113,8 @@ typedef struct TranslatorOps {
>      void (*insn_start)(DisasContextBase *db, CPUState *cpu);
>      bool (*breakpoint_check)(DisasContextBase *db, CPUState *cpu,
>                               const CPUBreakpoint *bp);
> -    void (*translate_insn)(DisasContextBase *db, CPUState *cpu);
> +    void (*translate_insn)(DisasContextBase *db, CPUState *cpu,
> +                           struct qemu_plugin_insn *plugin_insn);

I'm not convinced this is the best way to go about it. We end up having
to sprinkle the plugin calls into each decoder rather than keeping all
the infrastructure in the common main loop. However the common loop will
need to know the total number of bytes decoded so we could change the
declaration to:

  int (*translate_insn)(DisasContextBase *db, CPUState *cpu);

and return the number of bytes decoded. It would mean a minor
inefficiency in having to re-read the instruction bytes into a buffer in
preparation for passing to the plugin but it would all at least be in
one place.

--
Alex Bennée



reply via email to

[Prev in Thread] Current Thread [Next in Thread]