Hi everyone,

We were writing a TCG plugin, and for every instruction executed, we wanted
to know the privilege level where it was executed, i.e. was it in user mode
or kernel mode.

Approaches we tried:

1. We tried to use vcpu_syscall_cb/vcpu_syscall_ret_cb initially - any
instruction execution between invocations of these functions would be
marked as being in kernel mode. However, these callbacks don't seem to be
called in Qemu's full system emulation, and in Qemu's user mode emulation,
we won't get any privileged instructions executing anyway. Also, we would
miss interrupts/pagefaults in this way.

2. We thought we could look up the registers which store the privilege
level for our guest (AArch64 - current program status register). But, from
reading the code and from a previous mailing list thread "Qemu TCG Plugins
- how to access guest registers" , we saw that registers are not readable
from plugins either.

Is there a way to do this in the plugin API?

Thank you,
Milind

Reply via email to