Index: linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c =================================================================== --- linux-2.6-xen-sparse.orig/arch/i386/mm/ioremap-xen.c +++ linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c @@ -55,6 +55,7 @@ static int __direct_remap_pfn_range(stru int rc; unsigned long i, start_address; mmu_update_t *u, *v, *w; + int fixup = 1; u = v = w = (mmu_update_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT); if (u == NULL) @@ -65,6 +66,7 @@ static int __direct_remap_pfn_range(stru flush_cache_all(); for (i = 0; i < size; i += PAGE_SIZE) { + fixup = 1; if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) { /* Fill in the PTE pointers. */ rc = apply_to_page_range(mm, start_address, @@ -78,6 +80,7 @@ static int __direct_remap_pfn_range(stru goto out; v = u; start_address = address; + fixup = 0; } /* @@ -91,7 +94,11 @@ static int __direct_remap_pfn_range(stru v++; } - if (v != u) { + /* + * If we didn't finish the page in the previous loop then we + * need to process it now. + */ + if (fixup) { /* get the ptep's filled in */ rc = apply_to_page_range(mm, start_address, address - start_address,