[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Instruction virtual address in TCG Plugins
|
From: |
Mikhail Tyutin |
|
Subject: |
Instruction virtual address in TCG Plugins |
|
Date: |
Mon, 13 Nov 2023 18:33:48 +0000 |
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
- Instruction virtual address in TCG Plugins,
Mikhail Tyutin <=