如何查看系统中都注册了哪些MemoryRegion(QEMU2.0.0)

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/leoufung/article/details/48781207
1. 修改代码
${QEMU_SRC}/memory.c

static void render_memory_region(FlatView *view,
MemoryRegion *mr,
Int128 base,
AddrRange clip,
bool readonly){

....

int alias = 0;
int sub = 0;

.....

if (mr->alias) {
alias = 1;
//printf("Liufeng: render_memory_region 1\n");
int128_subfrom(&base, int128_make64(mr->alias->addr));
int128_subfrom(&base, int128_make64(mr->alias_offset));
render_memory_region(view, mr->alias, base, clip, readonly);
return;
}
......
/* Render subregions in priority order. */
QTAILQ_FOREACH(subregion, &mr->subregions, subregions_link) {
sub = 1;
//printf("Liufeng: render_memory_region 2\n");
render_memory_region(view, subregion, base, clip, readonly);
}

.....

/*这里加入是因为不用重复打印alias和sub, 因为它们是递归调用处理的*/

if(alias == 0 && sub == 0){
printf("Liufeng: render_memory_region mr.name = %s, offset_in_region = 0x%x\n",mr->name,offset_in_region);
}

.....

}

2.  运行QEMU,
输出结果实例:

Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x8000
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-low-memory, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = hpet, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = kvm-ioapic, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xc0000000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-pba, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-table, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-pba, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-table, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-mmio, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-bitblt-mmio, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-linear-io, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x8000
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-low-memory, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.rom, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.bios, offset_in_region = 0x20000
Liufeng: render_memory_region mr.name = pc.bios, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = kvm-apic-msi, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xcb000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xec000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xe8000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xe4000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xe0000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xdc000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xd8000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xd4000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xd0000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xcc000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xc8000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xc4000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xc0000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xf0000
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x8000
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-low-memory, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = hpet, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = kvm-ioapic, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0xc0000000
Liufeng: render_memory_region mr.name = pc.ram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-pba, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-table, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-pba, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = msix-table, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-mmio, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-bitblt-mmio, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-linear-io, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x8000
Liufeng: render_memory_region mr.name = vga.vram, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = cirrus-low-memory, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.rom, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = pc.bios, offset_in_region = 0x20000
Liufeng: render_memory_region mr.name = pc.bios, offset_in_region = 0x0
Liufeng: render_memory_region mr.name = kvm-apic-msi, offset_in_region = 0x0

3. 在按照名字找各个memoryRegion在哪里注册的
如:
如何查看系统中都注册了哪些MemoryRegion(QEMU2.0.0) - 六六哥 - 六六哥的博客
 
如何查看系统中都注册了哪些MemoryRegion(QEMU2.0.0) - 六六哥 - 六六哥的博客
 
展开阅读全文

没有更多推荐了,返回首页