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] [PATCH] vmx-copy_from_guest.patch

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] [PATCH] vmx-copy_from_guest.patch
From: Leendert van Doorn <leendert@xxxxxxxxxxxxxx>
Date: Tue, 06 Sep 2005 06:22:50 -0400
Cc: "Sharma, Arun" <arun.sharma@xxxxxxxxx>, "Ling, Xiaofeng" <xiaofeng.ling@xxxxxxxxx>, Ian Pratt <Ian.Pratt@xxxxxxxxxxxx>, "Petersson, Mats" <mats.petersson@xxxxxxx>
Delivery-date: Tue, 06 Sep 2005 15:20:39 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM T.J. Watson Research Center
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# seems current vmx_copy can not deal with copy over page boundary?
# so remove inst_copy_from_guest will cause problem.

Are you looking at the correct tree? Both xen-vt-testing and xen-unstable
have my newer vmx_copy that was introduced last Friday. It does handle
multiple pages.

int
vmx_copy(void *buf, unsigned long laddr, int size, int dir)
{
    unsigned long gpa, mfn;
    char *addr;
    int count;

    while (size > 0) {
        count = PAGE_SIZE - (laddr & ~PAGE_MASK);
        if (count > size)
            count = size;

        if (vmx_paging_enabled(current)) {
                gpa = gva_to_gpa(laddr);
                mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT);
        } else
                mfn = get_mfn_from_pfn(laddr >> PAGE_SHIFT);
        if (mfn == INVALID_MFN)
                return 0;

        addr = (char *)map_domain_page(mfn) + (laddr & ~PAGE_MASK);

        if (dir == VMX_COPY_IN)
            memcpy(buf, addr, count);
        else
            memcpy(addr, buf, count);

        unmap_domain_page(addr);

        laddr += count;
        buf += count;
        size -= count;
    }

    return 1;
}

        - Leendert

--
Leendert van Doorn                                    <leendert@xxxxxxxxxxxxxx>
IBM T.J. Watson Research Center                       (914) 784-7831
30 Saw Mill River Road, Hawthorne, NY 10532


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

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