WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Confusion about copy_to/from_guest

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Confusion about copy_to/from_guest
From: Tej <bewith.tej@xxxxxxxxx>
Date: Tue, 27 Apr 2010 17:22:00 +0530
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 27 Apr 2010 04:52:56 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=B1Xx2fi7e244NJSSOhhqxlm9INhbEpRaF8v07dMXJP4=; b=wb9sz4pTx6c/SJi6zn0RmIXjwSjGWa/1nnrv43sanuu6Jy7oc7mq5E3EXETgrLfOcI Z75ztpX88O+SvJtbZLMFdRCzh/R7oh+8tLGnUVAsJ0xN4KPXtB6xGsM9PVo/Sn6F7HZC rIJhqe+23HDu8rco4YNZFvmc00+BbhZ/oSriI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=tvdp17EMsxuqITwK/oezZwcJ6Z9cryYUpnem8lN/qgvKXxph5IoNPcDwnieOYgOX/0 yYIuDaaGy117o3dU8LNqkVfzv5ghzRlv6E6aWLGaZ2PvXHPhE/kZE4AM1lGyjxQzDfYw P5nbfZVTj2aH2+YfRA/j774SY2mftwZijBuqY=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C7FAE424.12628%keir.fraser@xxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <h2gf1c9d251004251932s19c2f51ofb422ee27c366fca@xxxxxxxxxxxxxx> <C7FAE424.12628%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Mon, Apr 26, 2010 at 11:03 AM, Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:
> On 26/04/2010 03:32, "Tej" <bewith.tej@xxxxxxxxx> wrote:
>
>> Now passing the list_head from kernel using hypercall. Now how do I
>> copy the element between kernel and hypervisor.
>>
>> 1. copy_from_guest(hyp_list_head, arg, 1) or
>> copy_from_guest(hyp_list_head, arg, <num_of_elements_list>)
>> 2. copy_to_guest(arg, hyp_list_head, 1) or copy_to_guest(arg,
>> hyp_list_head, <num of element in list>)
>
> The first of these. Copy_{to,from}_guest can copy arrays of structures, but
> since this is a linked structure you'd have to do the copy one element at a
> time.

you mean to say, in hypervisor space copy first element using
copy_from_guest(hyp_list_head, arg, 1), extract the next address from
it and then copy again the next element using
"copy_from_guest(hyp_list_head->next, arg->next, 1)" ???



>
>> 2nd question:
>> I did first one, but first element of list was not accessible in
>> hypervisor space, why?
>
> Well, if you are really only copying the list_head, the above should work.
Yes, I have carried out the sample test, by allocating small struct
linked list and then passing between hypervisor and kernel
copy_from_guest(hyp_list_head, arg, 1) is working correctly.

But my actial code is not working. Ok let me put some more effort, if
not I will push the code for review.

Thanks for your help

>
>  -- Keir
>
>
>

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>