Lines Matching refs:hd

132     HeapDesc*   hd;             // from which the block is allocated  member
340 HeapDesc* hd; in OSAllocFromHeap() local
354 hd = &HeapArray[heap]; in OSAllocFromHeap()
361 for (cell = hd->free; cell != NULL; cell = cell->next) in OSAllocFromHeap()
377 ASSERTMSG(cell->hd == NULL, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OSAllocFromHeap()
383 hd->free = DLExtract(hd->free, cell); in OSAllocFromHeap()
394 newCell->hd = NULL; in OSAllocFromHeap()
406 ASSERTMSG(hd->free == cell, OS_ERR_ALLOCFROMHEAP_BROKENHEAP); in OSAllocFromHeap()
407 hd->free = newCell; in OSAllocFromHeap()
412 hd->allocated = DLAddFront(hd->allocated, cell); in OSAllocFromHeap()
415 cell->hd = hd; in OSAllocFromHeap()
417 hd->headerBytes += HEADERSIZE; in OSAllocFromHeap()
418 hd->paddingBytes += cell->size - (HEADERSIZE + requested); in OSAllocFromHeap()
419 hd->payloadBytes += requested; in OSAllocFromHeap()
444 HeapDesc* hd; in OSAllocFixed() local
456 hd = &HeapArray[i]; in OSAllocFixed()
457 if (hd->size < 0) // Is inactive? in OSAllocFixed()
459 if (DLOverlap(hd->allocated, start, end)) in OSAllocFixed()
480 hd = &HeapArray[i]; in OSAllocFixed()
482 if (hd->size < 0) // Is inactive? in OSAllocFixed()
484 for (cell = hd->free; cell; cell = cell->next) in OSAllocFixed()
502 hd->free = DLExtract(hd->free, cell); // Note cell->next is intact. XXX in OSAllocFixed()
503 hd->size -= cell->size; // Update stats in OSAllocFixed()
519 newCell->hd = NULL; in OSAllocFixed()
528 hd->free = newCell; // new head in OSAllocFixed()
529 hd->size -= (char*) end - (char*) cell; in OSAllocFixed()
541 hd->size -= (char*) cellEnd - (char*) start; in OSAllocFixed()
551 newCell->hd = NULL; in OSAllocFixed()
559 hd->size -= (char*) end - (char*) start; in OSAllocFixed()
562 ASSERT(0 <= hd->size); in OSAllocFixed()
586 HeapDesc* hd; in OSFreeToHeap() local
596 hd = &HeapArray[heap]; in OSFreeToHeap()
598 ASSERTMSG(cell->hd == hd, OS_ERR_FREETOHEAP_INVPTR); in OSFreeToHeap()
599 ASSERTMSG(DLLookup(hd->allocated, cell),OS_ERR_FREETOHEAP_INVPTR); in OSFreeToHeap()
602 cell->hd = NULL; in OSFreeToHeap()
603 hd->headerBytes -= HEADERSIZE; in OSFreeToHeap()
604 hd->paddingBytes -= cell->size - (HEADERSIZE + cell->requested); in OSFreeToHeap()
605 hd->payloadBytes -= cell->requested; in OSFreeToHeap()
609 hd->allocated = DLExtract(hd->allocated, cell); in OSFreeToHeap()
612 hd->free = DLInsert(hd->free, cell); in OSFreeToHeap()
673 HeapDesc* hd = &HeapArray[i]; in OSInitAlloc() local
675 hd->size = -1; in OSInitAlloc()
676 hd->free = hd->allocated = NULL; in OSInitAlloc()
678 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OSInitAlloc()
714 HeapDesc* hd; in OSCreateHeap() local
744 hd = &HeapArray[heap]; in OSCreateHeap()
745 if (hd->size < 0) in OSCreateHeap()
747 hd->size = (char*) end - (char*) start; in OSCreateHeap()
752 cell->size = hd->size; in OSCreateHeap()
754 cell->hd = NULL; in OSCreateHeap()
757 hd->free = cell; in OSCreateHeap()
758 hd->allocated = 0; in OSCreateHeap()
760 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OSCreateHeap()
789 HeapDesc* hd; in OSDestroyHeap() local
798 hd = &HeapArray[heap]; in OSDestroyHeap()
802 size = DLSize(hd->free); in OSDestroyHeap()
803 if (hd->size != size) in OSDestroyHeap()
806 heap, size, hd->size); in OSDestroyHeap()
810 hd->size = -1; in OSDestroyHeap()
811 hd->free = hd->allocated = NULL; in OSDestroyHeap()
814 hd->paddingBytes = hd->headerBytes = hd->payloadBytes = 0; in OSDestroyHeap()
836 HeapDesc* hd; in OSAddToHeap() local
846 hd = &HeapArray[heap]; in OSAddToHeap()
874 cell->hd = NULL; in OSAddToHeap()
878 hd->size += cell->size; in OSAddToHeap()
879 hd->free = DLInsert(hd->free, cell); in OSAddToHeap()
905 HeapDesc* hd; in OSCheckHeap() local
913 hd = &HeapArray[heap]; in OSCheckHeap()
914 CHECK(0 <= hd->size); in OSCheckHeap()
916 CHECK(hd->allocated == NULL || hd->allocated->prev == NULL); in OSCheckHeap()
917 for (cell = hd->allocated; cell; cell = cell->next) in OSCheckHeap()
926 CHECK(0 < total && total <= hd->size); in OSCheckHeap()
929 CHECK(cell->hd == hd); in OSCheckHeap()
934 CHECK(hd->free == NULL || hd->free->prev == NULL); in OSCheckHeap()
935 for (cell = hd->free; cell; cell = cell->next) in OSCheckHeap()
946 CHECK(0 < total && total <= hd->size); in OSCheckHeap()
949 CHECK(cell->hd == NULL); in OSCheckHeap()
953 CHECK(total == hd->size); in OSCheckHeap()
979 ASSERTMSG(cell->hd, OS_ERR_REFERENT_INVPTR); in OSReferentSize()
980 ASSERTMSG(((char*) cell->hd - (char*) HeapArray) % sizeof(HeapDesc) == 0, in OSReferentSize()
982 ASSERTMSG(HeapArray <= cell->hd && cell->hd < &HeapArray[NumHeaps], in OSReferentSize()
984 ASSERTMSG(0 <= cell->hd->size, OS_ERR_REFERENT_INVPTR); in OSReferentSize()
985 ASSERTMSG(DLLookup(cell->hd->allocated, cell), in OSReferentSize()
1002 HeapDesc* hd; in OSDumpHeap() local
1010 hd = &HeapArray[heap]; in OSDumpHeap()
1011 if (hd->size < 0) in OSDumpHeap()
1021 hd->paddingBytes, 100.0 * hd->paddingBytes / hd->size, in OSDumpHeap()
1022 hd->headerBytes, 100.0 * hd->headerBytes / hd->size, in OSDumpHeap()
1023 hd->payloadBytes, 100.0 * hd->payloadBytes / hd->size in OSDumpHeap()
1029 ASSERTMSG(hd->allocated == NULL || hd->allocated->prev == NULL, in OSDumpHeap()
1031 for (cell = hd->allocated; cell; cell = cell->next) in OSDumpHeap()
1043 for (cell = hd->free; cell; cell = cell->next) in OSDumpHeap()