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] Mapping page table pages read-only

To: xen-devel list <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Mapping page table pages read-only
From: Simon Kagstrom <simon.kagstrom@xxxxxx>
Date: Tue, 02 May 2006 11:10:21 +0200
Delivery-date: Tue, 02 May 2006 02:10:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Wanderlust/2.15.2 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.4 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)
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

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