All of lore.kernel.org
 help / color / mirror / Atom feed
* Instruction virtual address in TCG Plugins
@ 2023-11-13 18:33 Mikhail Tyutin
  2023-11-13 20:58 ` Alex Bennée
  0 siblings, 1 reply; 7+ messages in thread
From: Mikhail Tyutin @ 2023-11-13 18:33 UTC (permalink / raw)
  To: qemu-devel@nongnu.org
  Cc: Richard Henderson, Alex Bennée, erdnaxe@crans.org,
	ma.mandourr@gmail.com

Greetings,

What is the right way to get virtual address of either translation block or instruction inside of TCG plugin? Does
plugin API allow that or it needs some extension?

So far I use qemu_plugin_tb_vaddr() inside of my block translation callback to get block virtual address and then
pass it as 'userdata' argument into qemu_plugin_register_vcpu_tb_exec_cb(). I use it later during code execution.
It works well for user-mode emulation, but sometimes leads to incorrect addresses in system-mode emulation.
I suspect it is because of memory mappings by guest OS that changes virtual addresses for that block.

I also looked at gen_empty_udata_cb() function and considered to extend plugin API to pass a program counter
value as additional callback argument. I thought it would always give me valid virtual address of an instruction.
Unfortunately, I didn't find a way to get value of that register in architecture agnostic way (it is 'pc' member in
CPUArchState structure).

---
Mikhail


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

end of thread, other threads:[~2023-11-22 12:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 18:33 Instruction virtual address in TCG Plugins Mikhail Tyutin
2023-11-13 20:58 ` Alex Bennée
2023-11-14  9:14   ` Mikhail Tyutin
2023-11-14 10:57     ` Alex Bennée
2023-11-21 16:39       ` Mikhail Tyutin
2023-11-21 17:24         ` Alex Bennée
2023-11-22 12:28           ` Mikhail Tyutin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.