/* * Imalloc initial setting */ EXPORT ER init_Imalloc( void ) { T_RSMB rsmb; ER ercd; InitSpinLock(&MemLockObj); ercd = RefSysMemInfo(&rsmb); if ( ercd < E_OK ) { goto err_ret; } pagesz = (UINT)rsmb.blksz; initIMACB(TA_RNG0); initIMACB(TA_RNG0|TA_NORESIDENT); initIMACB(TA_RNG3); initIMACB(TA_RNG3|TA_NORESIDENT); return E_OK; err_ret: BMS_DEBUG_PRINT(("init_Imalloc ercd = %d\n", ercd)); return ercd; }
/* * Imalloc initial setting */ EXPORT ER init_Imalloc( void ) { T_RSMB rsmb; ER ercd; ercd = RefSysMemInfo(&rsmb); if ( ercd < E_OK ) { goto err_ret; } pagesz = (UINT)rsmb.blksz; initIMACB(TA_RNG0); initIMACB(TA_RNG0|TA_NORESIDENT); initIMACB(TA_RNG3); initIMACB(TA_RNG3|TA_NORESIDENT); return E_OK; err_ret: #ifdef DEBUG TM_DEBUG_PRINT(("init_Imalloc ercd = %d\n", ercd)); #endif return ercd; }
/* * Imalloc initial setting */ EXPORT ER knl_init_Imalloc( void ) { /* Low-level memory management information */ IMPORT VP knl_lowmem_top, knl_lowmem_limit; VP memend; QUEUE *top, *end; /* Acquire system configuration definition information */ memend = CFN_REALMEMEND; if ( (UW)memend > (UW)knl_lowmem_limit ) { memend = knl_lowmem_limit; } /* Align top with 8 byte unit alignment */ knl_lowmem_top = (VP)(((UW)knl_lowmem_top + 7) & ~0x00000007UL); knl_imacb = (IMACB*)knl_lowmem_top; knl_lowmem_top = (VP)((UW)knl_lowmem_top + sizeof(IMACB)); top = (QUEUE*)knl_lowmem_top; knl_imacb->memsz = (W)((UW)memend - (UW)knl_lowmem_top - sizeof(QUEUE)*2); knl_lowmem_top = memend; /* Update memory free space */ initIMACB(); /* Register on AreaQue */ end = (QUEUE*)((VB*)top + knl_imacb->memsz) + 1; knl_insertAreaQue(&knl_imacb->areaque, end); knl_insertAreaQue(&knl_imacb->areaque, top); setAreaFlag(end, AREA_USE); setAreaFlag(&knl_imacb->areaque, AREA_USE); knl_appendFreeArea(knl_imacb, top); return E_OK; }