summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/mac68k/mac68k/machdep.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c
index e9516dc9df8..52afde535d5 100644
--- a/sys/arch/mac68k/mac68k/machdep.c
+++ b/sys/arch/mac68k/mac68k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.155 2010/07/02 19:57:14 tedu Exp $ */
+/* $OpenBSD: machdep.c,v 1.156 2010/11/20 20:29:09 miod Exp $ */
/* $NetBSD: machdep.c,v 1.207 1998/07/08 04:39:34 thorpej Exp $ */
/*
@@ -135,9 +135,10 @@ u_long IOBase;
vaddr_t SCSIBase;
/* These are used to map kernel space: */
+#define NBMEMRANGES 8
extern int numranges;
-extern u_long low[8];
-extern u_long high[8];
+extern u_long low[NBMEMRANGES];
+extern u_long high[NBMEMRANGES];
/* These are used to map NuBus space: */
#define NBMAXRANGES 16
@@ -240,8 +241,6 @@ mac68k_init()
/*
* Tell the VM system about available physical memory.
- * Notice that we don't need to worry about avail_end here
- * since it's equal to high[numranges-1].
*/
for (i = 0; i < numranges; i++) {
if (low[i] <= avail_start && avail_start < high[i])
@@ -1754,7 +1753,7 @@ get_mapping(void)
int i, last, same;
numranges = 0;
- for (i = 0; i < 8; i++) {
+ for (i = 0; i < NBMEMRANGES; i++) {
low[i] = 0;
high[i] = 0;
}
@@ -1787,7 +1786,7 @@ get_mapping(void)
if (numranges > 0 && phys == high[last]) {
/* Common case: extend existing segment on high end */
high[last] += PAGE_SIZE;
- } else {
+ } else if (numranges < NBMEMRANGES - 1) {
/* This is a new physical segment. */
for (last = 0; last < numranges; last++)
if (phys < low[last])
@@ -1804,6 +1803,9 @@ get_mapping(void)
numranges++;
low[last] = phys;
high[last] = phys + PAGE_SIZE;
+ } else {
+ /* Not enough ranges. Display a warning message? */
+ continue;
}
/* Coalesce adjoining segments as appropriate */