Received: from eggs.gnu.org ([208.118.235.92]:41912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4kMF-0008Mz-Jd for qemu-devel@nongnu.org; Thu, 23 Aug 2012 23:14:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4kMD-0006pt-Fn for qemu-devel@nongnu.org; Thu, 23 Aug 2012 23:14:51 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:17072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4kMC-0006ox-TJ for qemu-devel@nongnu.org; Thu, 23 Aug 2012 23:14:49 -0400 Received: from csmailer.cs.nctu.edu.tw (localhost [127.0.0.1]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id 136F340D for ; Fri, 24 Aug 2012 11:14:43 +0800 (CST) Received: from alumni.cs.nctu.edu.tw (alumni.cs.nctu.edu.tw [140.113.235.116]) by csmailer.cs.nctu.edu.tw (Postfix) with ESMTP id EE5BA40C for ; Fri, 24 Aug 2012 11:14:42 +0800 (CST) Received: (from chenwj@localhost) by alumni.cs.nctu.edu.tw (8.14.4/8.14.4/Submit) id q7O3EgRE063004 for qemu-devel@nongnu.org; Fri, 24 Aug 2012 11:14:42 +0800 (CST) (envelope-from chenwj) Date: Fri, 24 Aug 2012 11:14:42 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20120824031442.GA62168@cs.nctu.edu.tw> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Get host virtual address corresponding to guest physical address? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 =3D 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_ma= p(). That makes me not sure if I use cpu_physical_memory_map correctly, does it do what I want to do? Regards, chenwj --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) 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