Can anybody take a few minutes to answer my question? 2015-04-22 23:26 GMT+08:00 Wenjie Liu <lwj0...@gmail.com>:
> In http://vm-kernel.org/blog/2009/07/10/qemu-internal-part-2-softmmu/, > the following equation is mentioned. > host_virtual_address = phys_ram_base(qemu variable) + > guest_physical_address – guest_physical_address_base(0 in MIPS) > > I think I have got the phys_ram_base and guest_physical_address, but can > anybody tell me what is guest_physical_address_base? > I saw the memory allocation part in qemu/pc/pc.c: > > /* allocate RAM */ > ram_addr = qemu_ram_alloc(NULL, "pc.ram", > below_4g_mem_size + above_4g_mem_size); > cpu_register_physical_memory(0, 0xa0000, ram_addr); > cpu_register_physical_memory(0x100000, > below_4g_mem_size - 0x100000, > ram_addr + 0x100000); > #if TARGET_PHYS_ADDR_BITS > 32 > if (above_4g_mem_size > 0) { > cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size, > ram_addr + below_4g_mem_size); > } > #endif > > I think the 0x100000, 0xa0000 and 0x100000000ULL have some relation with > the guest_physical_address_base. > > Is that so? > > > > 2015-04-22 21:31 GMT+08:00 Wenjie Liu <lwj0...@gmail.com>: > >> Hi all, >> I have a little problem about the address mapping between host and guest >> in QEMU. >> >> I have got the guest physical address and the host virtual base address >> of guest's memory space which by check the ramblocks list. >> >> So, can I access to the guest's memory content by simply add the guest >> physical address with the base? >> >> For example, if the guest physical address of a guest memory request is >> 0x000000011f9ff000, and the host virtual base is 0x00007f37ef122000, I am >> going to access the host virtual address 0x000000011f9ff000 + >> 0x00007f37ef122000. >> Is this correct? >> >> >> -- >> >> *Best regards* >> > > > > -- > > *Best regards **from* > > Wenjie Liu > > TEL: (+86)132 9723 0518 > > E-mail: *lwj0...@gmail.com <lwj0...@gmail.com>* > > Wuhan National Laboratory for Optoelectronics, > > Huazhong University of Science&Technology, > > 1037 Luoyu Road Wuhan, Hubei,P.R.C, 430074. > -- *Best regards **from* Wenjie Liu TEL: (+86)132 9723 0518 E-mail: *lwj0...@gmail.com <lwj0...@gmail.com>* Wuhan National Laboratory for Optoelectronics, Huazhong University of Science&Technology, 1037 Luoyu Road Wuhan, Hubei,P.R.C, 430074.