Lines Matching refs:p_MM

175 static t_Error AddFree(t_MM *p_MM, uint64_t base, uint64_t end)  in AddFree()  argument
186 p_CurrB = p_MM->freeBlocks[i]; in AddFree()
231 p_MM->freeBlocks[i] = p_NewB; in AddFree()
247 p_MM->freeBlocks[i] = p_CurrB->p_Next; in AddFree()
271 p_MM->freeBlocks[i] = p_NewB; in AddFree()
307 static t_Error CutFree(t_MM *p_MM, uint64_t holdBase, uint64_t holdEnd) in CutFree() argument
317 p_CurrB = p_MM->freeBlocks[i]; in CutFree()
335 p_MM->freeBlocks[i] = p_CurrB->p_Next; in CutFree()
366 p_MM->freeBlocks[i] = p_CurrB->p_Next; in CutFree()
398 static void AddBusy(t_MM *p_MM, t_BusyBlock *p_NewBusyB) in AddBusy() argument
404 p_CurrBusyB = p_MM->busyBlocks; in AddBusy()
418 p_MM->busyBlocks = p_NewBusyB; in AddBusy()
444 static t_Error CutBusy(t_MM *p_MM, uint64_t base, uint64_t end) in CutBusy() argument
448 p_CurrB = p_MM->busyBlocks; in CutBusy()
483 p_MM->busyBlocks = p_CurrB->p_Next; in CutBusy()
541 static uint64_t MmGetGreaterAlignment(t_MM *p_MM, uint64_t size, uint64_t alignment, char* name) in MmGetGreaterAlignment() argument
550 p_FreeB = p_MM->freeBlocks[MM_MAX_ALIGNMENT]; in MmGetGreaterAlignment()
578 if ( CutFree ( p_MM, holdBase, holdEnd ) != E_OK ) in MmGetGreaterAlignment()
585 AddBusy ( p_MM, p_NewBusyB ); in MmGetGreaterAlignment()
598 t_MM *p_MM; in MM_Init() local
608 p_MM = (t_MM *)XX_Malloc(sizeof(t_MM)); in MM_Init()
609 if (!p_MM) in MM_Init()
614 p_MM->h_Spinlock = XX_InitSpinlock(); in MM_Init()
615 if (!p_MM->h_Spinlock) in MM_Init()
617 XX_Free(p_MM); in MM_Init()
622 p_MM->freeMemSize = size; in MM_Init()
625 p_MM->busyBlocks = 0; in MM_Init()
628 if ((p_MM->memBlocks = CreateNewBlock(base, size)) == NULL) in MM_Init()
630 MM_Free(p_MM); in MM_Init()
640 if ((p_MM->freeBlocks[i] = CreateFreeBlock(newBase, newSize)) == NULL) in MM_Init()
642 MM_Free(p_MM); in MM_Init()
647 *h_MM = p_MM; in MM_Init()
655 t_MM *p_MM = (t_MM *)h_MM; in MM_Free() local
662 ASSERT_COND(p_MM); in MM_Free()
665 p_BusyBlock = p_MM->busyBlocks; in MM_Free()
676 p_FreeBlock = p_MM->freeBlocks[i]; in MM_Free()
686 p_MemBlock = p_MM->memBlocks; in MM_Free()
694 if (p_MM->h_Spinlock) in MM_Free()
695 XX_FreeSpinlock(p_MM->h_Spinlock); in MM_Free()
698 XX_Free(p_MM); in MM_Free()
704 t_MM *p_MM = (t_MM *)h_MM; in MM_Get() local
710 SANITY_CHECK_RETURN_VALUE(p_MM, E_INVALID_HANDLE, (uint64_t)ILLEGAL_BASE); in MM_Get()
737 return (MmGetGreaterAlignment(p_MM, size, alignment, name)); in MM_Get()
740 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_Get()
742 p_FreeB = p_MM->freeBlocks[i]; in MM_Get()
749 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Get()
759 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Get()
764 if ( CutFree ( p_MM, holdBase, holdEnd ) != E_OK ) in MM_Get()
766 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Get()
772 p_MM->freeMemSize -= size; in MM_Get()
775 AddBusy ( p_MM, p_NewBusyB ); in MM_Get()
776 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Get()
784 t_MM *p_MM = (t_MM *)h_MM; in MM_GetForce() local
790 ASSERT_COND(p_MM); in MM_GetForce()
792 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_GetForce()
793 p_FreeB = p_MM->freeBlocks[0]; /* The biggest free blocks are in the in MM_GetForce()
809 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForce()
816 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForce()
821 if ( CutFree ( p_MM, base, base+size ) != E_OK ) in MM_GetForce()
823 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForce()
829 p_MM->freeMemSize -= size; in MM_GetForce()
832 AddBusy ( p_MM, p_NewBusyB ); in MM_GetForce()
833 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForce()
841 t_MM *p_MM = (t_MM *)h_MM; in MM_GetForceMin() local
847 ASSERT_COND(p_MM); in MM_GetForceMin()
862 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_GetForceMin()
863 p_FreeB = p_MM->freeBlocks[i]; in MM_GetForceMin()
875 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForceMin()
894 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForceMin()
905 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForceMin()
910 if ( CutFree( p_MM, holdBase, holdEnd ) != E_OK ) in MM_GetForceMin()
912 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForceMin()
918 p_MM->freeMemSize -= size; in MM_GetForceMin()
921 AddBusy( p_MM, p_NewBusyB ); in MM_GetForceMin()
922 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_GetForceMin()
930 t_MM *p_MM = (t_MM *)h_MM; in MM_Put() local
935 ASSERT_COND(p_MM); in MM_Put()
942 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_Put()
943 p_BusyB = p_MM->busyBlocks; in MM_Put()
952 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Put()
956 if ( AddFree( p_MM, p_BusyB->base, p_BusyB->end ) != E_OK ) in MM_Put()
958 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Put()
966 p_MM->busyBlocks = p_BusyB->p_Next; in MM_Put()
971 p_MM->freeMemSize += size; in MM_Put()
974 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Put()
982 t_MM *p_MM = (t_MM *)h_MM; in MM_PutForce() local
986 ASSERT_COND(p_MM); in MM_PutForce()
988 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_PutForce()
990 if ( CutBusy( p_MM, base, end ) != E_OK ) in MM_PutForce()
992 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_PutForce()
996 if ( AddFree ( p_MM, base, end ) != E_OK ) in MM_PutForce()
998 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_PutForce()
1003 p_MM->freeMemSize += size; in MM_PutForce()
1005 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_PutForce()
1013 t_MM *p_MM = (t_MM *)h_MM; in MM_Add() local
1018 ASSERT_COND(p_MM); in MM_Add()
1023 intFlags = XX_LockIntrSpinlock(p_MM->h_Spinlock); in MM_Add()
1025 p_MemB = p_MM->memBlocks; in MM_Add()
1030 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Add()
1038 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Add()
1045 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Add()
1053 errCode = AddFree(p_MM, base, base+size); in MM_Add()
1056 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Add()
1063 p_MM->freeMemSize += size; in MM_Add()
1065 XX_UnlockIntrSpinlock(p_MM->h_Spinlock, intFlags); in MM_Add()
1073 t_MM *p_MM = (t_MM*)h_MM; in MM_GetMemBlock() local
1077 ASSERT_COND(p_MM); in MM_GetMemBlock()
1079 p_MemBlock = p_MM->memBlocks; in MM_GetMemBlock()
1092 t_MM *p_MM = (t_MM*)h_MM; in MM_GetBase() local
1095 ASSERT_COND(p_MM); in MM_GetBase()
1097 p_MemBlock = p_MM->memBlocks; in MM_GetBase()
1104 t_MM *p_MM = (t_MM*)h_MM; in MM_InRange() local
1107 ASSERT_COND(p_MM); in MM_InRange()
1109 p_MemBlock = p_MM->memBlocks; in MM_InRange()
1120 t_MM *p_MM = (t_MM*)h_MM; in MM_GetFreeMemSize() local
1122 ASSERT_COND(p_MM); in MM_GetFreeMemSize()
1124 return p_MM->freeMemSize; in MM_GetFreeMemSize()
1130 t_MM *p_MM = (t_MM *)h_MM; in MM_Dump() local
1135 p_BusyB = p_MM->busyBlocks; in MM_Dump()
1147 p_FreeB = p_MM->freeBlocks[i]; in MM_Dump()