--- arch/x86/include/asm/x86_init.h | 2 +- arch/x86/kernel/x86_init.c | 3 ++- arch/x86/mm/init_32.c | 1 + arch/x86/mm/init_64.c | 1 + arch/x86/xen/mmu.c | 15 +++------------ 5 files changed, 8 insertions(+), 14 deletions(-) Index: linux-2.6/arch/x86/include/asm/x86_init.h =================================================================== --- linux-2.6.orig/arch/x86/include/asm/x86_init.h +++ linux-2.6/arch/x86/include/asm/x86_init.h @@ -76,7 +76,7 @@ struct x86_init_oem { * init_memory_mapping and the commit that added it. */ struct x86_init_mapping { - void (*pagetable_reserve)(u64 start, u64 end); + void (*mark_page_ro)(u64 addr); }; /** Index: linux-2.6/arch/x86/kernel/x86_init.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/x86_init.c +++ linux-2.6/arch/x86/kernel/x86_init.c @@ -28,6 +28,7 @@ void __cpuinit x86_init_noop(void) { } void __init x86_init_uint_noop(unsigned int unused) { } int __init iommu_init_noop(void) { return 0; } void iommu_shutdown_noop(void) { } +static void mark_page_ro_noop(u64 addr) { } /* * The platform setup functions are preset with the default functions @@ -63,7 +64,7 @@ struct x86_init_ops x86_init __initdata }, .mapping = { - .pagetable_reserve = native_pagetable_reserve, + .mark_page_ro = mark_page_ro_noop; }, .paging = { Index: linux-2.6/arch/x86/xen/mmu.c =================================================================== --- linux-2.6.orig/arch/x86/xen/mmu.c +++ linux-2.6/arch/x86/xen/mmu.c @@ -1177,18 +1177,9 @@ static void xen_exit_mmap(struct mm_stru static void xen_post_allocator_init(void); -static __init void xen_mapping_pagetable_reserve(u64 start, u64 end) +static __init void xen_mapping_mark_page_ro(u64 addr) { - /* reserve the range used */ - native_pagetable_reserve(start, end); - - /* set as RW the rest */ - printk(KERN_DEBUG "xen: setting RW the range %llx - %llx\n", end, - PFN_PHYS(pgt_buf_top)); - while (end < PFN_PHYS(pgt_buf_top)) { - make_lowmem_page_readwrite(__va(end)); - end += PAGE_SIZE; - } + make_lowmem_page_readonly(__va(addr)); } #ifdef CONFIG_X86_64 @@ -2177,7 +2168,7 @@ static const struct pv_mmu_ops xen_mmu_o void __init xen_init_mmu_ops(void) { - x86_init.mapping.pagetable_reserve = xen_mapping_pagetable_reserve; + x86_init.mapping.mark_page_ro = xen_mapping_mark_page_ro; x86_init.paging.pagetable_init = xen_pagetable_init; pv_mmu_ops = xen_mmu_ops; Index: linux-2.6/arch/x86/mm/init_32.c =================================================================== --- linux-2.6.orig/arch/x86/mm/init_32.c +++ linux-2.6/arch/x86/mm/init_32.c @@ -78,6 +78,7 @@ static __init void *alloc_low_page(void) } else pfn = pgt_buf_end++; + x86_init.mapping.mark_page_ro(pfn << PAGE_SHIFT); adr = __va(pfn * PAGE_SIZE); clear_page(adr); return adr; Index: linux-2.6/arch/x86/mm/init_64.c =================================================================== --- linux-2.6.orig/arch/x86/mm/init_64.c +++ linux-2.6/arch/x86/mm/init_64.c @@ -340,6 +340,7 @@ static __ref void *alloc_low_page(unsign } else pfn = pgt_buf_end++; + x86_init.mapping.mark_page_ro(pfn << PAGE_SHIFT); adr = early_memremap(pfn * PAGE_SIZE, PAGE_SIZE); clear_page(adr); *phys = pfn * PAGE_SIZE;