示例#1
0
文件: imalloc.c 项目: kidasan/tkernel
/*
 * 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;
}
示例#2
0
/*! Internal function used to initialize the vm descriptor structure*/
int VmDescriptorCacheConstructor(void * buffer)
{
	VM_DESCRIPTOR_PTR vd = (VM_DESCRIPTOR_PTR)buffer;
	memset(buffer, 0, sizeof(VM_DESCRIPTOR) );
	
	InitSpinLock( &vd->lock );
	
	return 0;
}
示例#3
0
文件: pid.c 项目: samueldotj/AceOS
/*! Initializes the PID global variables and returns pid info for kernel task*/
PID_INFO_PTR InitPid()
{
	InitSpinLock( &pid_info_lock );
	pid_root = NULL;
	
	PidCacheConstructor( &pid_zero );
	pid_zero.free_count = MAX_PROCESS_ID-1;
	
	return &pid_zero;
}
示例#4
0
/*! Initializes the given VM descriptor structure and adds it to the VM map
	\param descriptor - vm descriptor to be initialized
	\param vmap - virtual map of this descriptor
	\param start - starting va address of this descriptor range
	\param end - ending va address of this descriptor range
	\param vm_unit - vm unit which is backing this descriptor
	\param protection - protection for this range
*/
void InitVmDescriptor(VM_DESCRIPTOR_PTR descriptor, VIRTUAL_MAP_PTR vmap, VADDR start, VADDR end, VM_UNIT_PTR vm_unit, VM_PROTECTION_PTR protection)
{
	assert( descriptor != NULL );

	InitSpinLock( &descriptor->lock );
	descriptor->reference_count = 0;
	
	descriptor->virtual_map = vmap;
	
	InitAvlTreeNode( &descriptor->tree_node, 0 );
	
	descriptor->start = start;
	descriptor->end = end;
	descriptor->offset_in_unit = 0;
	
	memmove( &descriptor->protection, protection, sizeof(VM_PROTECTION) );
		
	descriptor->unit = vm_unit;
	InsertNodeIntoAvlTree(&vmap->descriptors, &descriptor->tree_node, 0, compare_vm_descriptor);
	vmap->descriptor_count++;
}