On 2/15/23 18:17, Mikhail Tyutin wrote:
ping
patchew link:
7d17f0cbb5ed4c90bbadd3992429006f@yadro.com/">https://patchew.org/QEMU/7d17f0cbb5ed4c90bbadd3992429006f@yadro.com/
10.02.2023 18:24, Mikhail Tyutin wrote:
This patch adds new function qemu_plugin_insn_disas_with_syntax() that allows
TCG
plugins to get disassembler string with non-default syntax if it wants to.
Signed-off-by: Mikhail Tyutin <m.tyutin@yadro.com>
Why?
It's certainly not very generic, exposing a disassembly quirk for exactly one
guest
architecture. I mean, you could just as easily link your plugin directly to
libcapstone
via qemu_plugin_insn_data().
r~
I agree it can be done outside of Qemu using another disassembler library. However,
there are few reasons to do it in Qemu from architecture standpoint:
1. To have a single place of instruction decoding logic. TCG has to decode
guest instructions
anyway. If plugins add another decoder, it causes double work and prone to
errors (however
current implementation does double decode work anyway). For example, TCG might
support
new instruction which is not available in external decoder yet.
2. Under the hood Qemu uses different implementations of decoder (in addition
to capstone)
which is not exposed in public interface. If there is a need to configure its
output, proposed
API allows that as well.
3. If multiple plugins want to use another disassembler syntax, they have to
share
implementation as utility function.