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

[Xen-devel] Mapping page table pages read-only



Hello!

I'm working on porting some IA-32 memory management code where the
page tables pages are read before updating to check consistency
(basically to catch cases where the old mapping is lost). However, I'm
not really sure how to map the page table pages read-only in Xen.

I have pages 1-1-mapped pseudo-physical to virtual for the page
tables, and if I just update the page directory as-is, i.e.:

   xen_flush_queue();
   xen_queue_pt_update(phys_to_machine(to_phys(pageDirectoryVaddr)) + 
sizeof(void*)*l2_table_offset(vaddr),
                       phys_to_machine(value) | (value & ~(PAGE_SIZE-1)) );
   xen_pt_pin((unsigned long)phys_to_machine(value));

(the code is based on the FreeBSD port and the MiniOS), I get the "Bad type" 
error:

(XEN) DOM220: (file=mm.c, line=1510) Bad type (saw f0000001 != exp 27ff0000) 
for mfn 1a6df (pfn 33da)
(XEN) DOM220: (file=mm.c, line=1780) Error while pinning mfn 1a6df

this goes away if I unmap the page first (update_va_mapping to
0). However, I'd like to keep the page mapped at the same 1-1
physical<->virtual address and still place it in the page
directory. I've tried

   HYPERVISOR_update_va_mapping((unsigned long)page,
                                (pte_t){(unsigned long)phys_to_machine(page)},
                                PRESENT);

, being careful to only set bit 0 (PRESENT), which should make the
page read-only. If I do this, however, I get an access violation on
access of the page table page. Can anyone tell me what I do wrong
here?

// Simon

_______________________________________________
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®.