mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-26 20:03:54 -06:00
plugin: Simplify struct qemu_plugin_hwaddr
Rather than saving MemoryRegionSection and offset, save phys_addr and MemoryRegion. This matches up much closer with the plugin api. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
0e1144400f
commit
405c02d85d
3 changed files with 17 additions and 37 deletions
|
@ -316,22 +316,7 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr)
|
|||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
if (haddr) {
|
||||
if (!haddr->is_io) {
|
||||
RAMBlock *block;
|
||||
ram_addr_t offset;
|
||||
void *hostaddr = haddr->v.ram.hostaddr;
|
||||
|
||||
block = qemu_ram_block_from_host(hostaddr, false, &offset);
|
||||
if (!block) {
|
||||
error_report("Bad host ram pointer %p", haddr->v.ram.hostaddr);
|
||||
abort();
|
||||
}
|
||||
|
||||
return block->offset + offset + block->mr->addr;
|
||||
} else {
|
||||
MemoryRegionSection *mrs = haddr->v.io.section;
|
||||
return mrs->offset_within_address_space + haddr->v.io.offset;
|
||||
}
|
||||
return haddr->phys_addr;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -341,13 +326,13 @@ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h)
|
|||
{
|
||||
#ifdef CONFIG_SOFTMMU
|
||||
if (h && h->is_io) {
|
||||
MemoryRegionSection *mrs = h->v.io.section;
|
||||
if (!mrs->mr->name) {
|
||||
unsigned long maddr = 0xffffffff & (uintptr_t) mrs->mr;
|
||||
g_autofree char *temp = g_strdup_printf("anon%08lx", maddr);
|
||||
MemoryRegion *mr = h->mr;
|
||||
if (!mr->name) {
|
||||
unsigned maddr = (uintptr_t)mr;
|
||||
g_autofree char *temp = g_strdup_printf("anon%08x", maddr);
|
||||
return g_intern_string(temp);
|
||||
} else {
|
||||
return g_intern_string(mrs->mr->name);
|
||||
return g_intern_string(mr->name);
|
||||
}
|
||||
} else {
|
||||
return g_intern_static_string("RAM");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue