qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] How QEMU manages guest machine's memory?


From: 陳韋任
Subject: [Qemu-devel] How QEMU manages guest machine's memory?
Date: Tue, 6 Sep 2011 11:42:02 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]