From: "陳韋任 (Wei-Ren Chen)" <chenwj@iis.sinica.edu.tw>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Get host virtual address corresponding to guest physical address?
Date: Fri, 24 Aug 2012 11:14:42 +0800 [thread overview]
Message-ID: <20120824031442.GA62168@cs.nctu.edu.tw> (raw)
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
next reply other threads:[~2012-08-24 3:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-24 3:14 陳韋任 (Wei-Ren Chen) [this message]
2012-08-25 8:02 ` [Qemu-devel] Get host virtual address corresponding to guest physical address? Blue Swirl
2012-08-25 10:56 ` Peter Maydell
2012-08-25 13:17 ` 陳韋任 (Wei-Ren Chen)
2012-08-25 14:32 ` Peter Maydell
2012-08-26 17:45 ` Blue Swirl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120824031442.GA62168@cs.nctu.edu.tw \
--to=chenwj@iis.sinica.edu.tw \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).