kernel/eka/euser/epoc/symc/uc_exec.cpp
branchanywhere
changeset 96 428c5911a502
parent 95 f561f9ae805b
child 101 86a1781f0e9b
equal deleted inserted replaced
95:f561f9ae805b 96:428c5911a502
    30 Symbian compatibility executive panics
    30 Symbian compatibility executive panics
    31 */
    31 */
    32 enum TSymcExecPanic
    32 enum TSymcExecPanic
    33 	{
    33 	{
    34 	ESymcExecPanicHeapAlreadyExists,
    34 	ESymcExecPanicHeapAlreadyExists,
    35 	ESymcExecPanicCreateHeapFailed
    35 	ESymcExecPanicCreateHeapFailed,
       
    36 	ESymcExecPanicNotUsed
    36 	};
    37 	};
    37 
    38 
    38 void Panic(TInt aReason)
    39 void Panic(TInt aReason)
    39 	{
    40 	{
    40 	_LIT(KCategory,"SYMC-Exec");
    41 	_LIT(KCategory,"SYMC-Exec");
   366 public:
   367 public:
   367 	RSemaphore iRequestSemaphore;
   368 	RSemaphore iRequestSemaphore;
   368 	CActiveScheduler* iActiveScheduler; //Current active scheduler for this thread. Used.
   369 	CActiveScheduler* iActiveScheduler; //Current active scheduler for this thread. Used.
   369 	TTrapHandler* iHandler; //This is our cleanup stack. Used.
   370 	TTrapHandler* iHandler; //This is our cleanup stack. Used.
   370 	//No idea why we need that trap stack
   371 	//No idea why we need that trap stack
   371 	TTrap* iTrapStack[KTrapStackSize];
   372 	//TTrap* iTrapStack[KTrapStackSize];
   372 	TInt iTrapCount;
   373 	//TInt iTrapCount;
   373 	};
   374 	};
   374 
   375 
   375 /*
   376 /*
   376 Object used to store process globals for our pseudo kernel.
   377 Object used to store process globals for our pseudo kernel.
   377 That's typically going to be a singleton.
   378 That's typically going to be a singleton.
   389 	};
   390 	};
   390 
   391 
   391 
   392 
   392 void TProcess::CreateHeap()
   393 void TProcess::CreateHeap()
   393 	{
   394 	{
   394 	iThread.iTrapCount=0;
   395 	//iThread.iTrapCount=0;
   395 	//Define the size of our heap
   396 	//Define the size of our heap
   396 	const TInt KHeapMaxSize=1024*1024*10; // 10 Mo for now
   397 	const TInt KHeapMaxSize=1024*1024*10; // 10 Mo for now
   397 	__ASSERT_ALWAYS(iAllocator==NULL && iBase==NULL,Panic(ESymcExecPanicHeapAlreadyExists));	
   398 	__ASSERT_ALWAYS(iAllocator==NULL && iBase==NULL,Panic(ESymcExecPanicHeapAlreadyExists));	
   398 	iBase=malloc(KHeapMaxSize);
   399 	iBase=malloc(KHeapMaxSize);
   399 	__ASSERT_ALWAYS(iBase!=NULL,Panic(ESymcExecPanicCreateHeapFailed));	
   400 	__ASSERT_ALWAYS(iBase!=NULL,Panic(ESymcExecPanicCreateHeapFailed));	
   431 	FAST_EXEC1(EFastExecHeapSwitch);
   432 	FAST_EXEC1(EFastExecHeapSwitch);
   432 	}
   433 	}
   433 
   434 
   434 __EXECDECL__ TTrapHandler* Exec::PushTrapFrame(TTrap* aTrap)
   435 __EXECDECL__ TTrapHandler* Exec::PushTrapFrame(TTrap* aTrap)
   435 	{
   436 	{
       
   437 	Panic(ESymcExecPanicNotUsed);
       
   438 	return NULL;
   436 	//FAST_EXEC1(EFastExecPushTrapFrame);
   439 	//FAST_EXEC1(EFastExecPushTrapFrame);
   437 	ASSERT(gProcess.iThread.iTrapCount<=KTrapStackSize);
   440 	//ASSERT(gProcess.iThread.iTrapCount<=KTrapStackSize);
   438 	gProcess.iThread.iTrapStack[gProcess.iThread.iTrapCount++]=aTrap;
   441 	//gProcess.iThread.iTrapStack[gProcess.iThread.iTrapCount++]=aTrap;
   439 	return gProcess.iThread.iHandler;
   442 	//return gProcess.iThread.iHandler;
   440 	}
   443 	}
   441 
   444 
   442 __EXECDECL__ TTrap* Exec::PopTrapFrame()
   445 __EXECDECL__ TTrap* Exec::PopTrapFrame()
   443 	{
   446 	{
       
   447 	Panic(ESymcExecPanicNotUsed);
       
   448 	return NULL;
   444 	//FAST_EXEC0(EFastExecPopTrapFrame);
   449 	//FAST_EXEC0(EFastExecPopTrapFrame);
   445 	ASSERT(gProcess.iThread.iTrapCount>0);
   450 	//ASSERT(gProcess.iThread.iTrapCount>0);
   446 	return gProcess.iThread.iTrapStack[gProcess.iThread.iTrapCount--];
   451 	//return gProcess.iThread.iTrapStack[gProcess.iThread.iTrapCount--];
   447 	}
   452 	}
   448 
   453 
   449 __EXECDECL__ CActiveScheduler* Exec::ActiveScheduler()
   454 __EXECDECL__ CActiveScheduler* Exec::ActiveScheduler()
   450 	{
   455 	{
   451 	FAST_EXEC0(EFastExecActiveScheduler);
   456 	FAST_EXEC0(EFastExecActiveScheduler);