From: Brendan Cully Subject: Re: Question about direct memory access of domU from dom0 Date: Thu, 10 Sep 2009 14:02:54 -0700 Message-ID: <20090910210254.GD23968@kremvax.cs.ubc.ca> References: <123bb170909101355k2d2cdec1o54ad50fb9ee81dac@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <123bb170909101355k2d2cdec1o54ad50fb9ee81dac@mail.gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeff Bickford Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Thursday, 10 September 2009 at 16:55, Jeff Bickford wrote: > Hello, > > I am porting a C application that requires taking a snapshot of memory on the > computer you are running. The original program uses an external PCI card to > read the memory and now I am trying to port this to xen. I want to run the > program in the dom0 guest but the memory that it will be taking a snapshot of > is the of memory in the domU guest. I am using the xen hypervisor 3.3. Is > there any specific library or API I can use in C to do this? The xen api on > xensource seems to only talk about xensource never about the hypervisor alone. > Thank you. Have a look at tools/libxc/xc_domain_save.c. That's the heart of xm save/xm migrate. Basically it's: 1. pause the domU 2. map its memory 3. copy it out 4. unpause You may need to map in batches if the guest memory is too large to fit in your copying process's address space.