qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/32] accel/tcg: Improve disassembly for target and plugin
@ 2024-04-05 10:24 Richard Henderson
  2024-04-05 10:24 ` [PATCH 01/32] accel/tcg: Use vaddr in translator_ld* Richard Henderson
                   ` (32 more replies)
  0 siblings, 33 replies; 54+ messages in thread
From: Richard Henderson @ 2024-04-05 10:24 UTC (permalink / raw)
  To: qemu-devel

Based-on: 20240404230611.21231-1-richard.henderson@linaro.org
("[PATCH v2 00/21] Rewrite plugin code generation")

While I was trying to debug something the other week, I noticed
that hppa_cpu_get_phys_page_debug was not using the same cpu state
as the translator, which meant that the disassembler read from a
different page than the translator, producing garbage.

I considered several ways to fix the issue, but I thought the
most effective would be to re-use the host page resolution that
the translator has already done.

Second, the same mechanism can be used to clean up plugin access
to each instruction's bytes and disassembly.

Third, the cache used for plugin access to mmio can be used to
allow s390x execute to disassemble the insn.

Finally, with the change to how plugins capture insn data, we
can and should use translator_ld* for everything the target wants
to read during translation.


r~


Richard Henderson (32):
  accel/tcg: Use vaddr in translator_ld*
  accel/tcg: Hide in_same_page outside of a target-specific context
  accel/tcg: Pass DisasContextBase to translator_fake_ldb
  accel/tcg: Reorg translator_ld*
  accel/tcg: Cap the translation block when we encounter mmio
  accel/tcg: Record mmio bytes during translation
  accel/tcg: Record when translator_fake_ldb is used
  accel/tcg: Record DisasContextBase in tcg_ctx for plugins
  plugins: Copy memory in qemu_plugin_insn_data
  accel/tcg: Implement translator_st
  plugins: Use translator_st for qemu_plugin_insn_data
  plugins: Read mem_only directly from TB cflags
  plugins: Use DisasContextBase for qemu_plugin_insn_haddr
  plugins: Use DisasContextBase for qemu_plugin_tb_vaddr
  plugins: Merge  alloc_tcg_plugin_context into plugin_gen_tb_start
  accel/tcg: Provide default implementation of disas_log
  accel/tcg: Return bool from TranslatorOps.disas_log
  disas: Split disas.c
  disas: Use translator_st to get disassembly data
  accel/tcg: Introduce translator_fake_ld
  target/s390x: Fix translator_fake_ld length
  target/s390x: Disassemble EXECUTEd instructions
  target/hexagon: Use translator_ldl in pkt_crosses_page
  target/microblaze: Use translator_ldl
  target/i386: Use translator_ldub for everything
  target/avr: Use translator_ldl
  target/cris: Use translator_ld* in cris_fetch
  target/cris: Use cris_fetch in translate_v10.c.inc
  target/riscv: Use translator_ld* for everything
  target/rx: Use translator_ld*
  target/xtensa: Use translator_ldub in xtensa_insn_len
  target/s390x: Use translator_lduw in get_next_pc

 disas/disas-internal.h           |   4 +
 include/disas/disas.h            |   9 +-
 include/exec/plugin-gen.h        |   7 +-
 include/exec/translator.h        |  70 +++++--
 include/qemu/plugin.h            |  22 +-
 include/qemu/qemu-plugin.h       |  15 +-
 include/qemu/typedefs.h          |   1 +
 include/tcg/tcg.h                |   1 +
 accel/tcg/plugin-gen.c           |  63 +++---
 accel/tcg/translator.c           | 331 +++++++++++++++++++-----------
 contrib/plugins/execlog.c        |   5 +-
 contrib/plugins/howvec.c         |   4 +-
 disas/disas-common.c             | 103 ++++++++++
 disas/disas-host.c               | 129 ++++++++++++
 disas/disas-mon.c                |  15 ++
 disas/disas-target.c             |  99 +++++++++
 disas/disas.c                    | 337 -------------------------------
 disas/objdump.c                  |  37 ++++
 plugins/api.c                    |  57 ++++--
 target/alpha/translate.c         |   9 -
 target/arm/tcg/translate-a64.c   |  11 -
 target/arm/tcg/translate.c       |  12 --
 target/avr/translate.c           |  11 +-
 target/cris/translate.c          |  37 +---
 target/hexagon/translate.c       |  11 +-
 target/hppa/translate.c          |  21 +-
 target/i386/tcg/translate.c      |  19 +-
 target/loongarch/tcg/translate.c |   8 -
 target/m68k/translate.c          |   9 -
 target/microblaze/translate.c    |  11 +-
 target/mips/tcg/translate.c      |   9 -
 target/nios2/translate.c         |  10 +-
 target/openrisc/translate.c      |  11 -
 target/ppc/translate.c           |   9 -
 target/riscv/translate.c         |  24 +--
 target/rx/translate.c            |  35 ++--
 target/s390x/tcg/translate.c     |  26 ++-
 target/sh4/translate.c           |   9 -
 target/sparc/translate.c         |   9 -
 target/tricore/translate.c       |   9 -
 target/xtensa/translate.c        |  12 +-
 tcg/tcg.c                        |  12 --
 target/cris/translate_v10.c.inc  |  30 +--
 disas/meson.build                |   8 +-
 44 files changed, 819 insertions(+), 862 deletions(-)
 create mode 100644 disas/disas-common.c
 create mode 100644 disas/disas-host.c
 create mode 100644 disas/disas-target.c
 delete mode 100644 disas/disas.c
 create mode 100644 disas/objdump.c

-- 
2.34.1



^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2024-04-08  8:54 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-05 10:24 [PATCH 00/32] accel/tcg: Improve disassembly for target and plugin Richard Henderson
2024-04-05 10:24 ` [PATCH 01/32] accel/tcg: Use vaddr in translator_ld* Richard Henderson
2024-04-05 12:34   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 02/32] accel/tcg: Hide in_same_page outside of a target-specific context Richard Henderson
2024-04-05 12:35   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 03/32] accel/tcg: Pass DisasContextBase to translator_fake_ldb Richard Henderson
2024-04-05 12:35   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 04/32] accel/tcg: Reorg translator_ld* Richard Henderson
2024-04-05 10:24 ` [PATCH 05/32] accel/tcg: Cap the translation block when we encounter mmio Richard Henderson
2024-04-05 12:36   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 06/32] accel/tcg: Record mmio bytes during translation Richard Henderson
2024-04-05 10:24 ` [PATCH 07/32] accel/tcg: Record when translator_fake_ldb is used Richard Henderson
2024-04-05 10:24 ` [PATCH 08/32] accel/tcg: Record DisasContextBase in tcg_ctx for plugins Richard Henderson
2024-04-05 10:24 ` [PATCH 09/32] plugins: Copy memory in qemu_plugin_insn_data Richard Henderson
2024-04-05 10:24 ` [PATCH 10/32] accel/tcg: Implement translator_st Richard Henderson
2024-04-05 10:24 ` [PATCH 11/32] plugins: Use translator_st for qemu_plugin_insn_data Richard Henderson
2024-04-05 10:24 ` [PATCH 12/32] plugins: Read mem_only directly from TB cflags Richard Henderson
2024-04-05 10:24 ` [PATCH 13/32] plugins: Use DisasContextBase for qemu_plugin_insn_haddr Richard Henderson
2024-04-05 10:24 ` [PATCH 14/32] plugins: Use DisasContextBase for qemu_plugin_tb_vaddr Richard Henderson
2024-04-05 12:40   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 15/32] plugins: Merge alloc_tcg_plugin_context into plugin_gen_tb_start Richard Henderson
2024-04-05 10:24 ` [PATCH 16/32] accel/tcg: Provide default implementation of disas_log Richard Henderson
2024-04-05 12:44   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 17/32] accel/tcg: Return bool from TranslatorOps.disas_log Richard Henderson
2024-04-05 12:45   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 18/32] disas: Split disas.c Richard Henderson
2024-04-05 10:24 ` [PATCH 19/32] disas: Use translator_st to get disassembly data Richard Henderson
2024-04-05 10:24 ` [PATCH 20/32] accel/tcg: Introduce translator_fake_ld Richard Henderson
2024-04-05 12:47   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 21/32] target/s390x: Fix translator_fake_ld length Richard Henderson
2024-04-05 10:24 ` [PATCH 22/32] target/s390x: Disassemble EXECUTEd instructions Richard Henderson
2024-04-05 10:24 ` [PATCH 23/32] target/hexagon: Use translator_ldl in pkt_crosses_page Richard Henderson
2024-04-05 10:24 ` [PATCH 24/32] target/microblaze: Use translator_ldl Richard Henderson
2024-04-05 12:53   ` Philippe Mathieu-Daudé
2024-04-05 12:59   ` Edgar E. Iglesias
2024-04-05 10:24 ` [PATCH 25/32] target/i386: Use translator_ldub for everything Richard Henderson
2024-04-05 12:57   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 26/32] target/avr: Use translator_ldl Richard Henderson
2024-04-05 12:56   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 27/32] target/cris: Use translator_ld* in cris_fetch Richard Henderson
2024-04-05 12:50   ` Philippe Mathieu-Daudé
2024-04-05 12:55   ` Edgar E. Iglesias
2024-04-05 10:24 ` [PATCH 28/32] target/cris: Use cris_fetch in translate_v10.c.inc Richard Henderson
2024-04-05 12:51   ` Philippe Mathieu-Daudé
2024-04-05 12:58   ` Edgar E. Iglesias
2024-04-05 10:24 ` [PATCH 29/32] target/riscv: Use translator_ld* for everything Richard Henderson
2024-04-05 10:24 ` [PATCH 30/32] target/rx: Use translator_ld* Richard Henderson
2024-04-05 12:55   ` Philippe Mathieu-Daudé
2024-04-08  8:53   ` Yoshinori Sato
2024-04-05 10:24 ` [PATCH 31/32] target/xtensa: Use translator_ldub in xtensa_insn_len Richard Henderson
2024-04-05 12:56   ` Philippe Mathieu-Daudé
2024-04-05 10:24 ` [PATCH 32/32] target/s390x: Use translator_lduw in get_next_pc Richard Henderson
2024-04-05 13:15 ` [PATCH 33/32] accel/tcg: Remove cpu_ldsb_code / cpu_ldsw_code Philippe Mathieu-Daudé
2024-04-05 17:48   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).