Example #1
0
/*
 * 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;
}
Example #2
0
/*
 * 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;
}
Example #3
0
/*
 * Get address space information
 */
LOCAL ER _GetSpaceInfo( VP addr, INT len, T_SPINFO *pk_spinfo )
{
	T_RSMB	rsmb;
	ER	ercd = E_OK;
	INT	cont, sz;
	VP	page, va, pa;

	if ( len <= 0 ) {
		ercd = E_PAR;
		goto err_ret;
	}
	ercd = ChkSpaceR(addr, len);
	if ( ercd < E_OK ){
		goto err_ret;
	}

	ercd = RefSysMemInfo(&rsmb);
	if ( ercd < E_OK ) {
		goto err_ret;
	}

	pk_spinfo->paddr   = toPhysicalAddress(addr);
	pk_spinfo->page    = (VP)((UW)(pk_spinfo->paddr) & ~(rsmb.blksz-1));
	pk_spinfo->pagesz  = rsmb.blksz;
	pk_spinfo->cachesz = GetCacheLineSize();

	cont = 0;
	page = pk_spinfo->page;
	va = addr;
	while ( cont < len ) {
		pa = toPhysicalAddress(va);
		if ( (pa < page) || ((page + rsmb.blksz) <= pa) ) {
			break;
		}
		sz = rsmb.blksz - (pa - page);
		cont += sz;
		page += rsmb.blksz;
		va += sz;
	}
	pk_spinfo->cont = ( cont <= len )? cont: len;

	return ercd;

err_ret:
	DEBUG_PRINT(("_GetSpaceInfo ercd = %d\n", ercd));
	return ercd;
}
Example #4
0
/*
 * Get address space information
 */
LOCAL ER _GetSpaceInfo( CONST void *addr, INT len, T_SPINFO *pk_spinfo )
{
	T_RSMB	rsmb;
	ER	ercd = E_OK;

	if ( len <= 0 ) {
		ercd = E_PAR;
		goto err_ret;
	}
	ercd = ChkSpaceR(addr, len);
	if ( ercd < E_OK ){
		goto err_ret;
	}

	ercd = RefSysMemInfo(&rsmb);
	if ( ercd < E_OK ) {
		goto err_ret;
	}

	pk_spinfo->paddr   = toPhysicalAddress(addr);
	pk_spinfo->page	   = (void*)((UW)(pk_spinfo->paddr) & ~(rsmb.blksz-1));
	pk_spinfo->pagesz  = rsmb.blksz;
	pk_spinfo->cachesz = GetCacheLineSize();

	/* Assumes here that logical and physical addresses are mapped linear.
	   This assures that physical page addresses are also contiguous 
	   if logical page addresses are contiguous. */
	pk_spinfo->cont = len;

	return ercd;

err_ret:
#ifdef DEBUG
	TM_DEBUG_PRINT(("_GetSpaceInfo ercd = %d\n", ercd));
#endif
	return ercd;
}