mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
plugins: Use DisasContextBase for qemu_plugin_insn_haddr
We can delay the computation of haddr until the plugin actually requests it. Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
e501325991
commit
d3ace10590
3 changed files with 24 additions and 25 deletions
|
@ -242,7 +242,30 @@ uint64_t qemu_plugin_insn_vaddr(const struct qemu_plugin_insn *insn)
|
|||
|
||||
void *qemu_plugin_insn_haddr(const struct qemu_plugin_insn *insn)
|
||||
{
|
||||
return insn->haddr;
|
||||
const DisasContextBase *db = tcg_ctx->plugin_db;
|
||||
vaddr page0_last = db->pc_first | ~TARGET_PAGE_MASK;
|
||||
|
||||
if (db->fake_insn) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* ??? The return value is not intended for use of host memory,
|
||||
* but as a proxy for address space and physical address.
|
||||
* Thus we are only interested in the first byte and do not
|
||||
* care about spanning pages.
|
||||
*/
|
||||
if (insn->vaddr <= page0_last) {
|
||||
if (db->host_addr[0] == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return db->host_addr[0] + insn->vaddr - db->pc_first;
|
||||
} else {
|
||||
if (db->host_addr[1] == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return db->host_addr[1] + insn->vaddr - (page0_last + 1);
|
||||
}
|
||||
}
|
||||
|
||||
char *qemu_plugin_insn_disas(const struct qemu_plugin_insn *insn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue