The zalloc pool's size calculation breaks if sbrk() does not return

contiguous chunks of memory.  It happens to do so in the bootstrap
code, but not necessarily in other places.
MFC after:	7 days
This commit is contained in:
dillon 2002-12-19 23:23:20 +00:00
parent 514c635ee6
commit 6dc747b608

View File

@ -247,22 +247,22 @@ zextendPool(MemPool *mp, void *base, iaddr_t bytes)
mp->mp_Base = base;
mp->mp_Used = bytes;
mp->mp_End = (char *)base + bytes;
mp->mp_Size = bytes;
} else {
void *pend = (char *)mp->mp_Base + mp->mp_Size;
if (base < mp->mp_Base) {
/* mp->mp_Size += (char *)mp->mp_Base - (char *)base; */
mp->mp_Size += (char *)mp->mp_Base - (char *)base;
mp->mp_Used += (char *)mp->mp_Base - (char *)base;
mp->mp_Base = base;
}
base = (char *)base + bytes;
if (base > pend) {
/* mp->mp_Size += (char *)base - (char *)pend; */
mp->mp_Size += (char *)base - (char *)pend;
mp->mp_Used += (char *)base - (char *)pend;
mp->mp_End = (char *)base;
}
}
mp->mp_Size += bytes;
}
#ifdef ZALLOCDEBUG