summaryrefslogtreecommitdiff
path: root/sys/arch/i386
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-03-26 04:01:00 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-03-26 04:01:00 +0000
commitda64e795de5dea2888362589ec1b47a9adec4bc4 (patch)
tree407584be539685aa84f9e8f511e8c85cfd423586 /sys/arch/i386
parent5e9ea134af3890e3042b743370bfd71b9d5ff976 (diff)
Allow the last page of physical memory (pci space) to be mapped. ok deraadt@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r--sys/arch/i386/i386/machdep.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c
index 3da7375f1bf..c9476af4188 100644
--- a/sys/arch/i386/i386/machdep.c
+++ b/sys/arch/i386/i386/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.286 2004/03/17 00:59:54 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.287 2004/03/26 04:00:59 drahn Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
@@ -3503,22 +3503,26 @@ bus_mem_add_mapping(bpa, size, cacheable, bshp)
u_long pa, endpa;
vaddr_t va;
pt_entry_t *pte;
+ bus_size_t map_size;
pa = i386_trunc_page(bpa);
endpa = i386_round_page(bpa + size);
#ifdef DIAGNOSTIC
- if (endpa <= pa)
+ if (endpa <= pa && endpa != 0)
panic("bus_mem_add_mapping: overflow");
#endif
- va = uvm_km_valloc(kernel_map, endpa - pa);
+ map_size = endpa - pa;
+
+ va = uvm_km_valloc(kernel_map, map_size);
if (va == 0)
return (ENOMEM);
*bshp = (bus_space_handle_t)(va + (bpa & PGOFSET));
- for (; pa < endpa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+ for (; map_size > 0;
+ pa += PAGE_SIZE, va += PAGE_SIZE, map_size -= PAGE_SIZE) {
pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE);
/*