kernel/eka/kernel/sutils.cpp
changeset 45 329ab0095843
parent 43 96e5fb8b040d
child 47 46fffbe7b5a7
equal deleted inserted replaced
44:36bfc973b146 45:329ab0095843
  1922 @post Calling thread is in a critical section.
  1922 @post Calling thread is in a critical section.
  1923 */
  1923 */
  1924 EXPORT_C DProcess* Kern::ProcessFromId(TUint aId)
  1924 EXPORT_C DProcess* Kern::ProcessFromId(TUint aId)
  1925 	{
  1925 	{
  1926 	DObjectCon& processes=*K::Containers[EProcess];
  1926 	DObjectCon& processes=*K::Containers[EProcess];
  1927 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::ProcessFromId");				
  1927 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::ProcessFromId");
  1928 	__ASSERT_WITH_MESSAGE_MUTEX(processes.Lock(),"Process container mutex must be held","Kern::ThreadFromId");			
  1928 	__ASSERT_WITH_MESSAGE_MUTEX(processes.Lock(),"Process container mutex must be held","Kern::ProcessFromId");
  1929 	//end of preconditions check
  1929 	//end of preconditions check
  1930 	TInt c=processes.Count();
  1930 	TInt c=processes.Count();
  1931 	TInt i;
  1931 	TInt i;
  1932 	for (i=0; i<c; i++)
  1932 	for (i=0; i<c; i++)
  1933 		{
  1933 		{
  3031 		if (!nt || NKern::KernelLocked())
  3031 		if (!nt || NKern::KernelLocked())
  3032 			m &= ~MASK_NO_RESCHED;
  3032 			m &= ~MASK_NO_RESCHED;
  3033 		}
  3033 		}
  3034 	if (!m)
  3034 	if (!m)
  3035 		return KErrNone;
  3035 		return KErrNone;
  3036 	if (aFunction)
  3036 	if (aFunction && aAddr)
  3037 		Kern::Printf("In function %s :-", aFunction);
  3037 		{
  3038 	else
  3038 		Kern::Printf("In function %s called from %08x :-", aFunction, aAddr);
  3039 		Kern::Printf("At address %08x :-", aAddr);
  3039 		}
       
  3040 	else 
       
  3041 		{
       
  3042 		if (aFunction)
       
  3043 			Kern::Printf("In function %s :-", aFunction);
       
  3044 		else
       
  3045 			Kern::Printf("At address %08x :-", aAddr);
       
  3046 		}
  3040 	if (m & MASK_NO_FAST_MUTEX)
  3047 	if (m & MASK_NO_FAST_MUTEX)
  3041 		Kern::Printf("Assertion failed: No fast mutex must be held");
  3048 		Kern::Printf("Assertion failed: No fast mutex must be held");
  3042 	if (m & MASK_NO_CRITICAL)
  3049 	if (m & MASK_NO_CRITICAL)
  3043 		Kern::Printf("Assertion failed: Calling thread must not be in critical section");
  3050 		Kern::Printf("Assertion failed: Calling thread must not be in critical section");
  3044 	if (m & MASK_CRITICAL)
  3051 	if (m & MASK_CRITICAL)
  4429 
  4436 
  4430 @prototype
  4437 @prototype
  4431 */
  4438 */
  4432 EXPORT_C TInt Kern::CreatePhysicalPinObject(TPhysicalPinObject*& aPinObject)
  4439 EXPORT_C TInt Kern::CreatePhysicalPinObject(TPhysicalPinObject*& aPinObject)
  4433 	{
  4440 	{
  4434 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::CreateVirtualPinObject");			
  4441 	CHECK_PRECONDITIONS(MASK_THREAD_CRITICAL,"Kern::CreatePhysicalPinObject");
  4435 	return M::CreatePhysicalPinObject(aPinObject);
  4442 	return M::CreatePhysicalPinObject(aPinObject);
  4436 	}
  4443 	}
  4437 
  4444 
  4438 /**
  4445 /**
  4439 Pins an area of physical memory. Suported by Kernel running flexible memory model.
  4446 Pins an area of physical memory. Suported by Kernel running flexible memory model.