[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] vmx-copy_from_guest.patch



# 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.