Lines Matching refs:cell
174 static Cell *DLAddFront(Cell * list, Cell * cell) in DLAddFront() argument
176 cell->next = list; in DLAddFront()
177 cell->prev = NULL; in DLAddFront()
180 list->prev = cell; in DLAddFront()
182 return cell; in DLAddFront()
195 static Cell *DLLookup(Cell * list, Cell * cell) in DLLookup() argument
199 if (list == cell) in DLLookup()
219 static Cell *DLExtract(Cell * list, Cell * cell) in DLExtract() argument
221 if (cell->next) in DLExtract()
223 cell->next->prev = cell->prev; in DLExtract()
226 if (cell->prev == NULL) in DLExtract()
228 return cell->next; in DLExtract()
232 cell->prev->next = cell->next; in DLExtract()
249 static Cell *DLInsert(Cell * list, Cell * cell) in DLInsert() argument
256 if (cell <= next) in DLInsert()
262 cell->next = next; in DLInsert()
263 cell->prev = prev; in DLInsert()
266 next->prev = cell; in DLInsert()
267 if ((char *)cell + cell->size == (char *)next) in DLInsert()
270 cell->size += next->size; in DLInsert()
271 cell->next = next = next->next; in DLInsert()
274 next->prev = cell; in DLInsert()
280 prev->next = cell; in DLInsert()
281 if ((char *)prev + prev->size == (char *)cell) in DLInsert()
284 prev->size += cell->size; in DLInsert()
295 return cell; // cell becomes new head of list in DLInsert()
313 Cell *cell; in DLOverlap() local
315 for (cell = list; cell; cell = cell->next) in DLOverlap()
317 if (RangeOverlap(cell, (char *)cell + cell->size, start, end)) in DLOverlap()
336 Cell *cell; in DLSize() local
339 for (cell = list; cell; cell = cell->next) in DLSize()
341 size += cell->size; in DLSize()
364 Cell *cell; // candidate block in OS_AllocFromHeap() local
405 for (cell = hd->free; cell != NULL; cell = cell->next) in OS_AllocFromHeap()
407 if ((long)size <= cell->size) in OS_AllocFromHeap()
413 if (cell == NULL) in OS_AllocFromHeap()
422 SDK_TASSERTMSG(OFFSET(cell, ALIGNMENT) == 0, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OS_AllocFromHeap()
423 SDK_TASSERTMSG(cell->hd == NULL, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OS_AllocFromHeap()
425 leftoverSize = cell->size - (long)size; in OS_AllocFromHeap()
429 hd->free = DLExtract(hd->free, cell); in OS_AllocFromHeap()
434 cell->size = (long)size; in OS_AllocFromHeap()
437 newCell = (Cell *) ((char *)cell + size); in OS_AllocFromHeap()
444 newCell->prev = cell->prev; in OS_AllocFromHeap()
445 newCell->next = cell->next; in OS_AllocFromHeap()
458 SDK_TASSERTMSG(hd->free == cell, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OS_AllocFromHeap()
464 hd->allocated = DLAddFront(hd->allocated, cell); in OS_AllocFromHeap()
467 cell->hd = hd; in OS_AllocFromHeap()
468 cell->requested = requested; in OS_AllocFromHeap()
470 hd->paddingBytes += cell->size - (HEADERSIZE + requested); in OS_AllocFromHeap()
476 return (void *)((char *)cell + HEADERSIZE); in OS_AllocFromHeap()
498 Cell *cell; // object iterator in OS_AllocFixed() local
551 for (cell = hd->free; cell; cell = cell->next) in OS_AllocFixed()
553 void *cellEnd = (char *)cell + cell->size; in OS_AllocFixed()
560 if ((char *)end <= (char *)cell) in OS_AllocFixed()
565 …if (InRange(cell, (char *)start - HEADERSIZE, end) && InRange((char *)cellEnd, start, (char *)end … in OS_AllocFixed()
567 if ((char *)cell < (char *)start) in OS_AllocFixed()
569 start = (void *)cell; in OS_AllocFixed()
577 hd->free = DLExtract(hd->free, cell); // Note cell->next is intact. XXX in OS_AllocFixed()
578 hd->size -= cell->size; // Update stats in OS_AllocFixed()
582 if (InRange(cell, (char *)start - HEADERSIZE, end)) in OS_AllocFixed()
584 if ((char *)cell < (char *)start) in OS_AllocFixed()
586 start = (void *)cell; in OS_AllocFixed()
598 newCell->next = cell->next; in OS_AllocFixed()
603 newCell->prev = cell->prev; in OS_AllocFixed()
612 hd->size -= (char *)end - (char *)cell; in OS_AllocFixed()
624 SDK_ASSERT(MINOBJSIZE <= (char *)start - (char *)cell); in OS_AllocFixed()
626 cell->size = (char *)start - (char *)cell; in OS_AllocFixed()
637 newCell->next = cell->next; in OS_AllocFixed()
642 newCell->prev = cell; in OS_AllocFixed()
643 cell->next = newCell; // cell is before newCell in OS_AllocFixed()
644 cell->size = (char *)start - (char *)cell; in OS_AllocFixed()
677 Cell *cell; in OS_FreeToHeap() local
705 cell = (Cell *) ((char *)ptr - HEADERSIZE); in OS_FreeToHeap()
708 SDK_TASSERTMSG(cell->hd == hd, OS_ERR_FREETOHEAP_INVPTR); in OS_FreeToHeap()
709 SDK_TASSERTMSG(DLLookup(hd->allocated, cell), OS_ERR_FREETOHEAP_INVPTR); in OS_FreeToHeap()
712 cell->hd = NULL; in OS_FreeToHeap()
714 hd->paddingBytes -= cell->size - (HEADERSIZE + cell->requested); in OS_FreeToHeap()
715 hd->payloadBytes -= cell->requested; in OS_FreeToHeap()
719 hd->allocated = DLExtract(hd->allocated, cell); in OS_FreeToHeap()
722 hd->free = DLInsert(hd->free, cell); in OS_FreeToHeap()
741 Cell *cell; in OS_FreeAllToHeap() local
759 while ((cell = hd->allocated) != NULL) in OS_FreeAllToHeap()
761 SDK_ASSERT(cell->hd == hd); in OS_FreeAllToHeap()
762 SDK_ASSERT(DLLookup(hd->allocated, cell)); in OS_FreeAllToHeap()
765 cell->hd = NULL; in OS_FreeAllToHeap()
767 hd->paddingBytes -= cell->size - (HEADERSIZE + cell->requested); in OS_FreeAllToHeap()
768 hd->payloadBytes -= cell->requested; in OS_FreeAllToHeap()
772 hd->allocated = DLExtract(hd->allocated, cell); in OS_FreeAllToHeap()
775 hd->free = DLInsert(hd->free, cell); in OS_FreeAllToHeap()
916 Cell *cell; in OS_CreateHeap() local
956 cell = (Cell *) start; in OS_CreateHeap()
957 cell->prev = NULL; in OS_CreateHeap()
958 cell->next = NULL; in OS_CreateHeap()
959 cell->size = hd->size; in OS_CreateHeap()
961 cell->hd = NULL; in OS_CreateHeap()
964 hd->free = cell; in OS_CreateHeap()
1002 Cell *cell; in OS_CreateExtraHeap() local
1023 cell = (Cell*)HW_MAIN_MEM_PARAMETER_BUF; in OS_CreateExtraHeap()
1024 cell->prev = NULL; in OS_CreateExtraHeap()
1025 cell->next = NULL; in OS_CreateExtraHeap()
1026 cell->size = HW_MAIN_MEM_PARAMETER_BUF_SIZE; in OS_CreateExtraHeap()
1028 cell->hd = NULL; in OS_CreateExtraHeap()
1030 hd->free = cell; in OS_CreateExtraHeap()
1132 Cell *cell; in OS_AddToHeap() local
1181 cell = (Cell *) start; in OS_AddToHeap()
1182 cell->size = (char *)end - (char *)start; in OS_AddToHeap()
1184 cell->hd = NULL; in OS_AddToHeap()
1188 hd->size += cell->size; in OS_AddToHeap()
1189 hd->free = DLInsert(hd->free, cell); in OS_AddToHeap()
1269 Cell *cell; in OS_CheckHeap() local
1294 for (cell = hd->allocated; cell; cell = cell->next) in OS_CheckHeap()
1301 OSi_CHECK(InRange(cell, heapInfo->arenaStart, heapInfo->arenaEnd)); in OS_CheckHeap()
1306 OSi_CHECK(OFFSET(cell, ALIGNMENT) == 0); in OS_CheckHeap()
1307 OSi_CHECK(cell->next == NULL || cell->next->prev == cell); in OS_CheckHeap()
1308 OSi_CHECK(MINOBJSIZE <= cell->size); in OS_CheckHeap()
1309 OSi_CHECK(OFFSET(cell->size, ALIGNMENT) == 0); in OS_CheckHeap()
1311 total += cell->size; in OS_CheckHeap()
1315 OSi_CHECK(cell->hd == hd); in OS_CheckHeap()
1316 OSi_CHECK(HEADERSIZE + cell->requested <= cell->size); in OS_CheckHeap()
1321 for (cell = hd->free; cell; cell = cell->next) in OS_CheckHeap()
1328 OSi_CHECK(InRange(cell, heapInfo->arenaStart, heapInfo->arenaEnd)); in OS_CheckHeap()
1333 OSi_CHECK(OFFSET(cell, ALIGNMENT) == 0); in OS_CheckHeap()
1334 OSi_CHECK(cell->next == NULL || cell->next->prev == cell); in OS_CheckHeap()
1335 OSi_CHECK(MINOBJSIZE <= cell->size); in OS_CheckHeap()
1336 OSi_CHECK(OFFSET(cell->size, ALIGNMENT) == 0); in OS_CheckHeap()
1337 OSi_CHECK(cell->next == NULL || (char *)cell + cell->size < (char *)cell->next); in OS_CheckHeap()
1339 total += cell->size; in OS_CheckHeap()
1340 free += cell->size - HEADERSIZE; in OS_CheckHeap()
1344 OSi_CHECK(cell->hd == NULL); in OS_CheckHeap()
1370 Cell *cell; in OS_ReferentSize() local
1391 cell = (Cell *) ((char *)ptr - HEADERSIZE); in OS_ReferentSize()
1393 SDK_TASSERTMSG(cell->hd, OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1394 …SDK_TASSERTMSG(((char *)cell->hd - (char *)heapInfo->heapArray) % sizeof(HeapDesc) == 0, OS_ERR_RE… in OS_ReferentSize()
1395 …SDK_TASSERTMSG(heapInfo->heapArray <= cell->hd && cell->hd < &heapInfo->heapArray[heapInfo->numHea… in OS_ReferentSize()
1396 SDK_TASSERTMSG(0 <= cell->hd->size, OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1397 SDK_TASSERTMSG(DLLookup(cell->hd->allocated, cell), OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1400 return (u32)(cell->size - HEADERSIZE); in OS_ReferentSize()
1418 Cell *cell; in OS_DumpHeap() local
1463 for (cell = hd->allocated; cell; cell = cell->next) in OS_DumpHeap()
1466 cell, cell->size, (char *)cell + cell->size, cell->prev, cell->next); in OS_DumpHeap()
1477 for (cell = hd->free; cell; cell = cell->next) in OS_DumpHeap()
1480 cell, cell->size, (char *)cell + cell->size, cell->prev, cell->next); in OS_DumpHeap()
1508 Cell *cell; in OS_VisitAllocated() local
1521 for (cell = heapInfo->heapArray[heap].allocated; cell; cell = cell->next) in OS_VisitAllocated()
1523 visitor((void *)((u8 *)cell + HEADERSIZE), (u32)(cell->size - HEADERSIZE)); in OS_VisitAllocated()
1549 Cell *cell; in OSi_GetTotalAllocSize() local
1566 for (cell = heapInfo->heapArray[heap].allocated; cell; cell = cell->next) in OSi_GetTotalAllocSize()
1568 sum += (u32)(cell->size); in OSi_GetTotalAllocSize()
1573 for (cell = heapInfo->heapArray[heap].allocated; cell; cell = cell->next) in OSi_GetTotalAllocSize()
1575 sum += (u32)(cell->size - HEADERSIZE); in OSi_GetTotalAllocSize()
1598 Cell *cell; in OS_GetTotalFreeSize() local
1613 for (cell = heapInfo->heapArray[heap].free; cell; cell = cell->next) in OS_GetTotalFreeSize()
1615 sum += (u32)(cell->size - HEADERSIZE); in OS_GetTotalFreeSize()
1636 Cell *cell; in OS_GetMaxFreeSize() local
1651 for (cell = heapInfo->heapArray[heap].free; cell; cell = cell->next) in OS_GetMaxFreeSize()
1653 u32 size = (u32)(cell->size - HEADERSIZE); in OS_GetMaxFreeSize()
1684 Cell *cell; in OS_ClearHeap() local
1720 cell = (Cell *) start; in OS_ClearHeap()
1721 cell->prev = NULL; in OS_ClearHeap()
1722 cell->next = NULL; in OS_ClearHeap()
1723 cell->size = hd->size; in OS_ClearHeap()
1725 cell->hd = NULL; in OS_ClearHeap()
1728 hd->free = cell; in OS_ClearHeap()