summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2000-10-24 02:05:37 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2000-10-24 02:05:37 +0000
commit2a88b121e359f90d3f3626e2bb8f4b2b783819c8 (patch)
treea0b2898afff903840ae5d56fef8abc0727407090 /sys
parentf9616e38de1ce92b146e2628a0525311820cab61 (diff)
Verify that memory regions are always page aligned and multiple of page size.
The kernel does not want to deal with memory that is not page aligned.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index f79e8a620ca..756e02d47a2 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.19 2000/07/28 13:02:12 rahnds Exp $ */
+/* $OpenBSD: pmap.c,v 1.20 2000/10/24 02:05:36 drahn Exp $ */
/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -351,6 +351,18 @@ pmap_bootstrap(kernelstart, kernelend)
*/
kernelstart &= ~PGOFSET;
kernelend = (kernelend + PGOFSET) & ~PGOFSET;
+
+ /* make certain that each section is page aligned for base and size */
+ for (mp = avail; mp->size; mp++) {
+ u_int32_t end;
+ s = mp->start - round_page(mp->start);
+ if (s != 0) {
+ mp->start = round_page(mp->start);
+ end = trunc_page(mp->size + mp->start);
+ mp->size = end - mp->start;
+ }
+ mp->size = trunc_page(mp->size);
+ }
for (mp = avail; mp->size; mp++) {
/*
* Check whether this region holds all of the kernel.
@@ -479,7 +491,7 @@ avail_end = npgs * NBPG;
potable = (struct pte_ovtab *)mp->start;
mp->size -= sz;
mp->start += sz;
- if (mp->size <= 0)
+ if (mp->size == 0)
bcopy(mp + 1, mp, (cnt - (mp - avail)) * sizeof *mp);
for (i = 0; i < ptab_cnt; i++)
LIST_INIT(potable + i);