|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] Writing a not present shadow entry
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>
|
- [Xen-devel] Writing a not present shadow entry,
Cutter 409 <=
|
|
|
|
|