In mem_regions(), deal with the case of a run of consecutive holes.

Now the cube works with the memory in any order.
This commit is contained in:
mycroft 2000-12-05 05:16:00 +00:00
parent e7a6bcd6eb
commit e4ae5a1406

View File

@ -1,4 +1,4 @@
/* $NetBSD: ofw_machdep.c,v 1.6 2000/09/24 15:57:03 tsubai Exp $ */
/* $NetBSD: ofw_machdep.c,v 1.7 2000/12/05 05:16:00 mycroft Exp $ */
/*
* Copyright (C) 1996 Wolfgang Solfrank.
@ -76,12 +76,13 @@ mem_regions(memp, availp)
/* Remove zero sized entry in the returned data. */
cnt /= sizeof OFmem[0];
for (i = 0; i < cnt; i++)
for (i = 0; i < cnt; )
if (OFmem[i].size == 0) {
bcopy(&OFmem[i + 1], &OFmem[i],
(cnt - i) * sizeof OFmem[0]);
cnt--;
}
} else
i++;
bzero(OFavail, sizeof OFavail);
cnt = OF_getprop(phandle, "available",
@ -90,12 +91,13 @@ mem_regions(memp, availp)
goto error;
cnt /= sizeof OFavail[0];
for (i = 0; i < cnt; i++)
for (i = 0; i < cnt; )
if (OFavail[i].size == 0) {
bcopy(&OFavail[i + 1], &OFavail[i],
(cnt - i) * sizeof OFavail[0]);
cnt--;
}
} else
i++;
*memp = OFmem;
*availp = OFavail;