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

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) - 六六哥 - 六六哥的博客
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值