qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: Jidong Xiao <jidong.xiao@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] How does qemu know the virtual memory of the guest os?
Date: Sun, 30 Nov 2014 23:28:03 +0000	[thread overview]
Message-ID: <20141130232803.GD14637@redhat.com> (raw)
In-Reply-To: <CAG4AFWZG-kFVxsf-cd_pHyg50ZNKO1xm-Hcja8kUpzmKTZn0Uw@mail.gmail.com>

On Fri, Nov 28, 2014 at 04:17:10PM -0800, Jidong Xiao wrote:
> Hi,
> 
> I notice that Qemu supports dump virtual memory of Guest OS. As this
> page suggests:
> 
> ========
> http://doc.opensuse.org/products/draft/SLES/SLES-kvm_sd_draft/cha.qemu.monitor.html
> 
> To save the content of the virtual machine memory to a disk or console
> output, use the following commands:
> 
> memsave addr size filename
> 
> Saves virtual memory dump starting at addr of size size to file filename
> 
> pmemsave addr size filename
> 
> Saves physical memory dump starting at addr of size size to file filename
> =========
> 
> I understand that hypervisors certainly know the physical memory of
> virtual machine, but how does it know the virtual memory of the Guest
> OS? I think the hypervisor has no semantic knowledge of the Guest OS,
> and such knowledge should be different for different OS (e.g., Windows
> vs Linux), so I am really surprised that Qemu can dump the virtual
> memory of the Guest OS. Can someone kindly give me some explanation?
> Thank you very much!!

It's different for each *architecture*, but not for each OS.

For example on x86 it starts by reading the CR* control registers, and
then the page tables (see target-i386/helper.c:
x86_cpu_get_phys_page_debug).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

      reply	other threads:[~2014-11-30 23:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-29  0:17 [Qemu-devel] How does qemu know the virtual memory of the guest os? Jidong Xiao
2014-11-30 23:28 ` Richard W.M. Jones [this message]

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=20141130232803.GD14637@redhat.com \
    --to=rjones@redhat.com \
    --cc=jidong.xiao@gmail.com \
    --cc=kvm@vger.kernel.org \
    --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).