Our approach to this problem was to make the plugin sensitive to the execution
of well-chosen instructions to turn on/turn off the actions of the plugin. The
plugin will still be called (don't unregister it) but should return immediately
if the on/off state is off. This will still slow the emulation down.
My guest ISA is arm64. For that ISA, we made these choices; perhaps something
else is better:
asm("hint 0b0010001"); // arm64 PSB Profile Sync Buffer (turn on)
asm("hint 0b0010010"); // arm64 TSB Trace Sync Buffer (turn off)
Put these instructions in a library and arrange to have your application call
the library functions as appropriate for the application's programming language.
________________________________
From: Qemu-discuss <[email protected]> on
behalf of Kamil Garifullin <[email protected]>
Sent: Wednesday, July 29, 2020 1:35 AM
To: [email protected] <[email protected]>
Subject: [EXTERNAL] QEMU plugin system
Hi,
I'm trying to create a plugin which will track an activity during a particular
period of time.
Can I somehow send a signal from the guest to the instrumentation plugin?
For example, I want to boot linux, do some preparations, then start a targeted
application and start my tracking. It can be both: do not inject
instrumentation until special indication or just a special plugin event to set
up some flags.
My thoughts were to have an event which will indicate that pmon was touched. It
allows you to do all the preparations in the guest machine, then dump pmons as
an indicator to start tracking and then run the target application.