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

[Xen-devel] Writing a not present shadow entry

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Writing a not present shadow entry
From: Cutter 409 <cutter409@xxxxxxxxx>
Date: Thu, 9 Dec 2010 14:26:43 -0500
Delivery-date: Thu, 09 Dec 2010 11:27:57 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=FTJhKa3Bsy18tTT+KamDSEDhImtehVf2moheyyXV/fA=; b=D9jgxoMJZpBIyG13+7KNaFrIshjVq5oCWWnPWJEAvBThfdeqz7w4WCUEHmzRNgjx1c 3F56gd9ywfNMcsm0P7VPFJD9cEvCF7NjpqMYAxfBGXXpmxvtv7QWh/hG3b+w+6JpzoSY qayye9Q5zq/qLJ83d+oge+e5qTfn991ysfdQ4=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=DnilYY8h6iXpwrQW2ofWsb+SfwxEnNblWzRsjIxAkSTikfpuyppmHjQWbWvgOZGZxU dM+7FVtJUzXjG8HVP/Yn9rdDRyGLLcil7LsPt61XcC5VtVCp+SdJW7ueCnfFIE8k9Ct0 fnuuJXeib9m1/exCXFI0qJj/O9G6fLKEkpHQg=
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/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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hello,

I'm trying to do something similar to what Ether does, using Xen 3.4.2
My function to write a not present shadow entry doesn't seem to work. I never catch a page fault for an address that I've marked not present.

The function in question should take a virtual address and write a shadow entry for it, marking it either present or not present.
If it's not present I should be able to detect when the guest accesses it.

static int sh_set_present(struct vcpu *v, unsigned long vaddr, int present, int need_lock) {
    shadow_l1e_t sl1e;
    walk_t gw;
    shadow_l1e_t *ptr_sl1e;

    gfn_t gfn = _gfn(0);
    mfn_t gmfn, sl1mfn = _mfn(0);
    p2m_type_t p2mt;

    int result = 0;

    if(need_lock)
        shadow_lock(v->domain);

    // Returns 0 for success
    if(unlikely(sh_walk_guest_tables(v, vaddr, &gw, p2mt) != 0)) {
        printk("Unable to walk guest tables\n")    ;
        goto done;
    }

    /* What mfn is the guest trying to access? */
    gfn = guest_l1e_get_gfn(gw.l1e);
    gmfn = gfn_to_mfn_guest(v->domain, gfn, &p2mt);


    // Create the shadow entry
    ptr_sl1e = shadow_get_and_create_l1e(v, &gw, &sl1mfn, ft_demand_read);

    // Calculate the shadow entry
    l1e_propagate_from_guest(v, gw.l1e, gmfn, &sl1e, ft_demand_read, p2mt);

    if (present) {
        sl1e = shadow_l1e_add_flags(sl1e, _PAGE_PRESENT);
    } else {
        // I don't think we should have to do this part..
        sl1e = shadow_l1e_remove_flags(sl1e, _PAGE_PRESENT);
    }

    // Write the shadow entry
    printk("shadow_set_l1e: %X\n", shadow_set_l1e(v, ptr_sl1e, sl1e, sl1mfn));

/*    printk("Set %lX as", vaddr);
    if(!present)
        printk(" NOT");
    printk(" present\n");*/

    result = 1;

done:
    if(need_lock)
        shadow_unlock(v->domain);

    return result;
}

I do have ept disabled. Can anyone give me any ideas about what could be wrong, or how to go about debugging this? I'm not extremely familiar with the shadow page table.

Thanks!
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>