Module Name: src Committed By: reinoud Date: Tue Jul 24 13:59:26 UTC 2012
Modified Files: src/sys/arch/usermode/usermode: pmap.c Log Message: Adding an assert that checks for struct pmap_l2 not being bigger than PAGE_SIZE. While here, also add possible bug allerts of temporary mmaps that might screw up memory. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.104 src/sys/arch/usermode/usermode/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/usermode/usermode/pmap.c diff -u src/sys/arch/usermode/usermode/pmap.c:1.103 src/sys/arch/usermode/usermode/pmap.c:1.104 --- src/sys/arch/usermode/usermode/pmap.c:1.103 Fri Mar 2 16:56:32 2012 +++ src/sys/arch/usermode/usermode/pmap.c Tue Jul 24 13:59:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.103 2012/03/02 16:56:32 reinoud Exp $ */ +/* $NetBSD: pmap.c,v 1.104 2012/07/24 13:59:26 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk <rein...@netbsd.org> @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2012/03/02 16:56:32 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2012/07/24 13:59:26 reinoud Exp $"); #include "opt_memsize.h" #include "opt_kmempages.h" @@ -204,6 +204,9 @@ pmap_bootstrap(void) if (TRAPSTACKSIZE < 4*PAGE_SIZE) { panic("TRAPSTACKSIZE is too small, please increase UPAGES"); } + if (sizeof(struct pmap_l2) > PAGE_SIZE) { + panic("struct pmap_l2 bigger than one page?\n"); + } /* protect user memory UVM area (---) */ err = thunk_munmap((void *) kmem_user_start, @@ -1202,6 +1205,7 @@ pmap_zero_page(paddr_t pa) if (pa & (PAGE_SIZE-1)) panic("%s: unaligned address passed : %p\n", __func__, (void *) pa); + /* XXX bug alart: can we allow the kernel to make a decision on this? */ blob = thunk_mmap(NULL, PAGE_SIZE, THUNK_PROT_READ | THUNK_PROT_WRITE, THUNK_MAP_FILE | THUNK_MAP_SHARED, @@ -1227,6 +1231,7 @@ pmap_copy_page(paddr_t src_pa, paddr_t d thunk_printf_debug("pmap_copy_page: pa src %p, pa dst %p\n", (void *) src_pa, (void *) dst_pa); + /* XXX bug alart: can we allow the kernel to make a decision on this? */ sblob = thunk_mmap(NULL, PAGE_SIZE, THUNK_PROT_READ, THUNK_MAP_FILE | THUNK_MAP_SHARED, @@ -1234,6 +1239,7 @@ pmap_copy_page(paddr_t src_pa, paddr_t d if (!sblob) panic("%s: couldn't get src mapping", __func__); + /* XXX bug alart: can we allow the kernel to make a decision on this? */ dblob = thunk_mmap(NULL, PAGE_SIZE, THUNK_PROT_READ | THUNK_PROT_WRITE, THUNK_MAP_FILE | THUNK_MAP_SHARED,