Lines Matching refs:hd

113     HeapDesc *hd;                      // from which the block is allocated  member
359 HeapDesc *hd; in OS_AllocFromHeap() local
394 hd = &heapInfo->heapArray[heap]; in OS_AllocFromHeap()
401 for (cell = hd->free; cell != NULL; cell = cell->next) in OS_AllocFromHeap()
419 SDK_ASSERTMSG(cell->hd == NULL, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OS_AllocFromHeap()
425 hd->free = DLExtract(hd->free, cell); in OS_AllocFromHeap()
436 newCell->hd = NULL; in OS_AllocFromHeap()
454 SDK_ASSERTMSG(hd->free == cell, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OS_AllocFromHeap()
455 hd->free = newCell; in OS_AllocFromHeap()
460 hd->allocated = DLAddFront(hd->allocated, cell); in OS_AllocFromHeap()
463 cell->hd = hd; in OS_AllocFromHeap()
465 hd->headerBytes += HEADERSIZE; in OS_AllocFromHeap()
466 hd->paddingBytes += cell->size - (HEADERSIZE + requested); in OS_AllocFromHeap()
467 hd->payloadBytes += requested; in OS_AllocFromHeap()
496 HeapDesc *hd; in OS_AllocFixed() local
514 hd = &heapInfo->heapArray[i]; in OS_AllocFixed()
515 if (hd->size < 0) // Is inactive? in OS_AllocFixed()
520 if (DLOverlap(hd->allocated, start, end)) in OS_AllocFixed()
541 hd = &heapInfo->heapArray[i]; in OS_AllocFixed()
543 if (hd->size < 0) // Is inactive? in OS_AllocFixed()
548 for (cell = hd->free; cell; cell = cell->next) in OS_AllocFixed()
571 hd->free = DLExtract(hd->free, cell); // Note cell->next is intact. XXX in OS_AllocFixed()
572 hd->size -= cell->size; // Update stats in OS_AllocFixed()
590 newCell->hd = NULL; in OS_AllocFixed()
604 hd->free = newCell; // new head in OS_AllocFixed()
606 hd->size -= (char *)end - (char *)cell; in OS_AllocFixed()
619 hd->size -= (char *)cellEnd - (char *)start; in OS_AllocFixed()
629 newCell->hd = NULL; in OS_AllocFixed()
639 hd->size -= (char *)end - (char *)start; in OS_AllocFixed()
642 SDK_ASSERT(0 <= hd->size); in OS_AllocFixed()
670 HeapDesc *hd; in OS_FreeToHeap() local
693 hd = &heapInfo->heapArray[heap]; in OS_FreeToHeap()
695 SDK_ASSERTMSG(cell->hd == hd, OS_ERR_FREETOHEAP_INVPTR); in OS_FreeToHeap()
696 SDK_ASSERTMSG(DLLookup(hd->allocated, cell), OS_ERR_FREETOHEAP_INVPTR); in OS_FreeToHeap()
699 cell->hd = NULL; in OS_FreeToHeap()
700 hd->headerBytes -= HEADERSIZE; in OS_FreeToHeap()
701 hd->paddingBytes -= cell->size - (HEADERSIZE + cell->requested); in OS_FreeToHeap()
702 hd->payloadBytes -= cell->requested; in OS_FreeToHeap()
706 hd->allocated = DLExtract(hd->allocated, cell); in OS_FreeToHeap()
709 hd->free = DLInsert(hd->free, cell); in OS_FreeToHeap()
727 HeapDesc *hd; in OS_FreeAllToHeap() local
745 hd = &heapInfo->heapArray[heap]; in OS_FreeAllToHeap()
746 while ((cell = hd->allocated) != NULL) in OS_FreeAllToHeap()
748 SDK_ASSERT(cell->hd == hd); in OS_FreeAllToHeap()
749 SDK_ASSERT(DLLookup(hd->allocated, cell)); in OS_FreeAllToHeap()
752 cell->hd = NULL; in OS_FreeAllToHeap()
753 hd->headerBytes -= HEADERSIZE; in OS_FreeAllToHeap()
754 hd->paddingBytes -= cell->size - (HEADERSIZE + cell->requested); in OS_FreeAllToHeap()
755 hd->payloadBytes -= cell->requested; in OS_FreeAllToHeap()
759 hd->allocated = DLExtract(hd->allocated, cell); in OS_FreeAllToHeap()
762 hd->free = DLInsert(hd->free, cell); in OS_FreeAllToHeap()
844 HeapDesc *hd = &heapInfo->heapArray[i]; in OS_InitAlloc() local
846 hd->size = -1; in OS_InitAlloc()
847 hd->free = hd->allocated = NULL; in OS_InitAlloc()
849 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OS_InitAlloc()
904 HeapDesc *hd; in OS_CreateHeap() local
943 hd = &heapInfo->heapArray[heap]; in OS_CreateHeap()
944 if (hd->size < 0) in OS_CreateHeap()
946 hd->size = (char *)end - (char *)start; in OS_CreateHeap()
951 cell->size = hd->size; in OS_CreateHeap()
953 cell->hd = NULL; in OS_CreateHeap()
956 hd->free = cell; in OS_CreateHeap()
957 hd->allocated = 0; in OS_CreateHeap()
959 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OS_CreateHeap()
991 HeapDesc *hd; in OS_DestroyHeap() local
1006 hd = &heapInfo->heapArray[heap]; in OS_DestroyHeap()
1010 size = DLSize(hd->free); in OS_DestroyHeap()
1011 if (hd->size != size) in OS_DestroyHeap()
1014 hd->size); in OS_DestroyHeap()
1018 hd->size = -1; in OS_DestroyHeap()
1019 hd->free = hd->allocated = NULL; // add to dolphin src in OS_DestroyHeap()
1022 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OS_DestroyHeap()
1049 HeapDesc *hd; in OS_AddToHeap() local
1065 hd = &heapInfo->heapArray[heap]; in OS_AddToHeap()
1094 cell->hd = NULL; in OS_AddToHeap()
1098 hd->size += cell->size; in OS_AddToHeap()
1099 hd->free = DLInsert(hd->free, cell); in OS_AddToHeap()
1152 HeapDesc *hd; in OS_CheckHeap() local
1174 hd = &heapInfo->heapArray[heap]; in OS_CheckHeap()
1175 OSi_CHECK(0 <= hd->size); in OS_CheckHeap()
1177 OSi_CHECK(hd->allocated == NULL || hd->allocated->prev == NULL); in OS_CheckHeap()
1178 for (cell = hd->allocated; cell; cell = cell->next) in OS_CheckHeap()
1187 OSi_CHECK(0 < total && total <= hd->size); in OS_CheckHeap()
1190 OSi_CHECK(cell->hd == hd); in OS_CheckHeap()
1195 OSi_CHECK(hd->free == NULL || hd->free->prev == NULL); in OS_CheckHeap()
1196 for (cell = hd->free; cell; cell = cell->next) in OS_CheckHeap()
1207 OSi_CHECK(0 < total && total <= hd->size); in OS_CheckHeap()
1210 OSi_CHECK(cell->hd == NULL); in OS_CheckHeap()
1214 OSi_CHECK(total == hd->size); in OS_CheckHeap()
1252 SDK_ASSERTMSG(cell->hd, OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1253 SDK_ASSERTMSG(((char *)cell->hd - (char *)heapInfo->heapArray) % sizeof(HeapDesc) == 0, in OS_ReferentSize()
1255 SDK_ASSERTMSG(heapInfo->heapArray <= cell->hd in OS_ReferentSize()
1256 && cell->hd < &heapInfo->heapArray[heapInfo->numHeaps], OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1257 SDK_ASSERTMSG(0 <= cell->hd->size, OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1258 SDK_ASSERTMSG(DLLookup(cell->hd->allocated, cell), OS_ERR_REFERENT_INVPTR); in OS_ReferentSize()
1278 HeapDesc *hd; in OS_DumpHeap() local
1296 hd = &heapInfo->heapArray[heap]; in OS_DumpHeap()
1297 if (hd->size < 0) in OS_DumpHeap()
1307 hd->paddingBytes, 100.0 * hd->paddingBytes / hd->size, in OS_DumpHeap()
1308 hd->headerBytes, 100.0 * hd->headerBytes / hd->size, in OS_DumpHeap()
1309 hd->payloadBytes, 100.0 * hd->payloadBytes / hd->size); in OS_DumpHeap()
1315 SDK_ASSERTMSG(hd->allocated == NULL || hd->allocated->prev == NULL, OS_ERR_DUMPHEAP_BROKENHEAP); in OS_DumpHeap()
1316 if ( ! hd->allocated ) in OS_DumpHeap()
1322 for (cell = hd->allocated; cell; cell = cell->next) in OS_DumpHeap()
1330 if ( ! hd->free ) in OS_DumpHeap()
1336 for (cell = hd->free; cell; cell = cell->next) in OS_DumpHeap()
1540 HeapDesc *hd; in OS_ClearHeap() local
1566 hd = &heapInfo->heapArray[heap]; in OS_ClearHeap()
1567 hd->size = (char *)end - (char *)start; in OS_ClearHeap()
1572 cell->size = hd->size; in OS_ClearHeap()
1574 cell->hd = NULL; in OS_ClearHeap()
1577 hd->free = cell; in OS_ClearHeap()
1578 hd->allocated = 0; in OS_ClearHeap()
1580 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OS_ClearHeap()