$NetBSD: patch-ah,v 1.1 2004/05/08 18:24:00 cl Exp $

--- xc/lib/xc_linux_build.c.orig	2004-04-18 04:29:15.000000000 +0200
+++ xc/lib/xc_linux_build.c
@@ -222,6 +222,10 @@ static int setup_guestos(int xc_handle,
     if ( (vl2tab = map_pfn(pm_handle, l2tab >> PAGE_SHIFT)) == NULL )
         goto error_out;
     memset(vl2tab, 0, PAGE_SIZE);
+    unmap_pfn(pm_handle, vl2tab);
+    if ( (vl2tab = map_pfn_ro(pm_handle, l2tab >> PAGE_SHIFT)) == NULL )
+        goto error_out;
+    mlock(vl2tab, PAGE_SIZE);
     vl2e = vl2tab + l2_table_offset(virt_load_addr);
     for ( count = 0; count < tot_pages; count++ )
     {    
@@ -231,6 +235,10 @@ static int setup_guestos(int xc_handle,
             if ( (vl1tab = map_pfn(pm_handle, l1tab >> PAGE_SHIFT)) == NULL )
                 goto error_out;
             memset(vl1tab, 0, PAGE_SIZE);
+            unmap_pfn(pm_handle, vl1tab);
+            if ( (vl1tab = map_pfn_ro(pm_handle, l1tab >> PAGE_SHIFT)) == NULL )
+                goto error_out;
+            mlock(vl1tab, PAGE_SIZE);
             alloc_index--;
   
             vl1e = vl1tab + l1_table_offset(virt_load_addr + 
