Hi, all I am trying to figure out how QEMU manages the guest machine's memory. If I understand correctly, QEMU uses RAMBlock as a unit when it allocates guest machine's memory. All RAMBlocks are maintained in RAMList. Guest machine needs to call qemu_ram_alloc first to get a RAMBlock, then call cpu_register_physical_memory to register that RAMBlock to QEMU.
Take PC machine as an example, void pc_memory_init(ram_addr_t ram_size, ...) { // ram_addr is the offset of the allocated RAMBlock in the RAMList, // right? ram_addr = qemu_ram_alloc(NULL, "pc.ram", below_4g_mem_size + above_4g_mem_size); // RAMBlock is paged by QEMU, and this information is stored in // PhysPageDesc, right? cpu_register_physical_memory(0, 0xa0000, ram_addr); } Is PhysPageDesc used to maintain GPA -> HVA mapping? If someone can give me a high level overview on how QEMU manages the guest machine's memory, I'll be very appreciate that. Thanks! Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667