kernel/eka/kernel/sinit.cpp
branchRCL_3
changeset 43 c1f20ce4abcf
parent 39 2bb754abd467
child 44 3e88ff8f41d5
equal deleted inserted replaced
42:a179b74831c9 43:c1f20ce4abcf
    42 _LIT(KDShBufThreadName,"DShBufThread");
    42 _LIT(KDShBufThreadName,"DShBufThread");
    43 const TInt KDShBufThreadPriority = 7; // same priority as normal background thread
    43 const TInt KDShBufThreadPriority = 7; // same priority as normal background thread
    44 const TInt KDfcThread0Priority=27;
    44 const TInt KDfcThread0Priority=27;
    45 const TInt KDfcThread1Priority=48;
    45 const TInt KDfcThread1Priority=48;
    46 const TInt KMaxEventQueue=40;
    46 const TInt KMaxEventQueue=40;
       
    47 
       
    48 #ifdef __SMP__
       
    49 _LIT(KRebalanceName, "LB");
       
    50 const TInt KRebalancePriority=26;
       
    51 #endif
    47 
    52 
    48 TInt SupervisorThread(TAny*);
    53 TInt SupervisorThread(TAny*);
    49 TInt DebuggerInit();
    54 TInt DebuggerInit();
    50 extern TInt InitialiseEntropyBuffers();
    55 extern TInt InitialiseEntropyBuffers();
    51 
    56 
   393 	TInt r=K::Init3();
   398 	TInt r=K::Init3();
   394 	if (r!=KErrNone)
   399 	if (r!=KErrNone)
   395 		K::Fault(K::EInit3Failed);
   400 		K::Fault(K::EInit3Failed);
   396 
   401 
   397 	P::StartExtensions();
   402 	P::StartExtensions();
       
   403 
   398 	M::Init4();
   404 	M::Init4();
       
   405 
       
   406 #ifdef __SMP__
       
   407 	TheScheduler.InitLB();
       
   408 	TheScheduler.StartPeriodicBalancing();
       
   409 #endif
       
   410 
   399 	K::StartKernelServer();
   411 	K::StartKernelServer();
   400 	return 0;
   412 	return 0;
   401 	}
   413 	}
   402 
   414 
   403 TInt K::Init3()
   415 TInt K::Init3()
   433 
   445 
   434 	// create the DfcQ for DShPool
   446 	// create the DfcQ for DShPool
   435 	r = Kern::DfcQInit(&DShPool::iSharedDfcQue,KDShBufThreadPriority,&KDShBufThreadName);
   447 	r = Kern::DfcQInit(&DShPool::iSharedDfcQue,KDShBufThreadPriority,&KDShBufThreadName);
   436 	if (r!=KErrNone)
   448 	if (r!=KErrNone)
   437 		return r;
   449 		return r;
       
   450 
       
   451 #ifdef __SMP__
       
   452 	// create thread and DFC queue for load balancing
       
   453 	TScheduler& s = TheScheduler;
       
   454 	r = Kern::DfcQCreate(s.iRebalanceDfcQ, KRebalancePriority, &KRebalanceName);
       
   455 	if (r!=KErrNone)
       
   456 		return r;
       
   457 	NThread* nt = TScheduler::LBThread();
       
   458 	NKern::ThreadSetCpuAffinity(nt, KCpuAffinityAny);
       
   459 	pT = _LOFF(nt, DThread, iNThread);
       
   460 	pT->iFlags |= KThreadFlagSystemPermanent;
       
   461 #endif
   438 
   462 
   439 	// Initialise the RAM drive
   463 	// Initialise the RAM drive
   440 	K::InitNvRam();
   464 	K::InitNvRam();
   441 
   465 
   442 	// Start the millisecond timer
   466 	// Start the millisecond timer