Hi all,

  I would like to know if there is a function in QEMU which converts
a guest physical address into corresponding host virtual address. I
guess cpu_physical_memory_map (exec.c) can do the job, but I have a
few questions.

  1. I am running x86 guest on a x86_64 host and using the cod below
     to get the host virtual address, I am not sure what value of len
     should be.

        static inline void *gpa2hva(target_phys_addr_t addr)
        {
            target_phys_addr_t len = 4;
            return cpu_physical_memory_map(addr, &len, 0);
        }

  2. There is a function "cpu_physical_memory_unmap", the comment
     of it says,

       Unmaps a memory region previously mapped by cpu_physical_memory_map().

     That makes me not sure if I use cpu_physical_memory_map correctly,
     does it do what I want to do?

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj

Reply via email to