kernel/eka/compsupp/symaehabi/symbian_support.cpp
changeset 266 0008ccd16016
parent 0 a41df078684a
equal deleted inserted replaced
259:57b9594f5772 266:0008ccd16016
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "ARM EABI LICENCE.txt"
     4 // under the terms of the License "ARM EABI LICENCE.txt"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // in kernel/eka/compsupp.
     6 // in kernel/eka/compsupp.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // e32/compsupp/symaehabi/symbian_support.cpp
    14 // e32/compsupp/symaehabi/symbian_support.cpp
    15 // 
    15 //
    16 //
    16 //
    17 
    17 
    18 /* Environment: */
    18 /* Environment: */
    19 #include "unwind_env.h"
    19 #include "unwind_env.h"
    20 /* Language-independent unwinder declarations: */
    20 /* Language-independent unwinder declarations: */
    38 namespace NAMES { void default_unexpected_handler(void); }
    38 namespace NAMES { void default_unexpected_handler(void); }
    39 
    39 
    40 EXPORT_C TCppRTExceptionsGlobals::TCppRTExceptionsGlobals()
    40 EXPORT_C TCppRTExceptionsGlobals::TCppRTExceptionsGlobals()
    41 	{
    41 	{
    42 	buffer.inuse = false;
    42 	buffer.inuse = false;
       
    43 	buffer.em_buf2_p = NULL;
    43 	thread_globals.uncaughtExceptions = 0;
    44 	thread_globals.uncaughtExceptions = 0;
    44 	thread_globals.unexpectedHandler = NAMES::default_unexpected_handler;
    45 	thread_globals.unexpectedHandler = NAMES::default_unexpected_handler;
    45 	thread_globals.terminateHandler = __default_terminate_handler;
    46 	thread_globals.terminateHandler = __default_terminate_handler;
    46 	thread_globals.implementation_ever_called_terminate = false;
    47 	thread_globals.implementation_ever_called_terminate = false;
    47 	thread_globals.call_hook = NULL;
    48 	thread_globals.call_hook = NULL;
    48 	thread_globals.caughtExceptions = NULL;
    49 	thread_globals.caughtExceptions = NULL;
    49 	thread_globals.propagatingExceptions = NULL;
    50 	thread_globals.propagatingExceptions = NULL;
    50 	thread_globals.emergency_buffer = &buffer;
    51 	thread_globals.emergency_buffer = &buffer;
    51 	Dll::SetTls(this);
    52 	Dll::SetTls(this);
    52 	}
    53 	}
       
    54 
       
    55 EXPORT_C void TCppRTExceptionsGlobals::Init2ndEmergencyBuffer()
       
    56 	{
       
    57 	ASSERT(buffer.em_buf2_p == NULL);
       
    58 
       
    59 	TEmergencyBuffer2* p = (TEmergencyBuffer2*) User::Alloc( sizeof(TEmergencyBuffer2) );
       
    60 	if (!p)
       
    61 		abort();
       
    62 	p->Init();
       
    63 	buffer.em_buf2_p = p;
       
    64 	}
       
    65 
       
    66 EXPORT_C void TCppRTExceptionsGlobals::Kill2ndEmergencyBuffer()
       
    67 	{
       
    68 	ASSERT(buffer.em_buf2_p);
       
    69 
       
    70 	User::Free(buffer.em_buf2_p);
       
    71 	}
       
    72 
    53 #if __ARMCC_VERSION < 220000
    73 #if __ARMCC_VERSION < 220000
    54 extern "C" 
    74 extern "C"
    55 {
    75 {
    56   /*
    76   /*
    57     we have to dummy up the following for 2.1. The names changed in the def file
    77     we have to dummy up the following for 2.1. The names changed in the def file
    58     since in 2.2 catch handlers should be able to deal with imported RTTI
    78     since in 2.2 catch handlers should be able to deal with imported RTTI
    59 
    79 
    76 	{
    96 	{
    77 	// reserve a DEF file slot for RTTI
    97 	// reserve a DEF file slot for RTTI
    78 	}
    98 	}
    79 }
    99 }
    80 
   100 
    81 #else 
   101 #else
    82 // This is the key function that forces the class impedimenta to be get exported in RVCT 2.2 and later.
   102 // This is the key function that forces the class impedimenta to be get exported in RVCT 2.2 and later.
    83 EXPORT_C void XLeaveException::ForceKeyFunction(){}
   103 EXPORT_C void XLeaveException::ForceKeyFunction(){}
    84 #endif
   104 #endif
    85 
   105 
    86 #if 0
   106 #if 0
   222 	if (!aEDp)
   242 	if (!aEDp)
   223 		{
   243 		{
   224 		// look in extension ROM if there is one
   244 		// look in extension ROM if there is one
   225 		TUint main_start = UserSvr::RomHeaderAddress();
   245 		TUint main_start = UserSvr::RomHeaderAddress();
   226 		TUint main_end = main_start + ((TRomHeader*)main_start)->iUncompressedSize;
   246 		TUint main_end = main_start + ((TRomHeader*)main_start)->iUncompressedSize;
   227 		
   247 
   228 		TUint rda = UserSvr::RomRootDirectoryAddress();
   248 		TUint rda = UserSvr::RomRootDirectoryAddress();
   229 		
   249 
   230 		// Assume rom starts on multiple of 4k
   250 		// Assume rom starts on multiple of 4k
   231 		if (rda > main_end)
   251 		if (rda > main_end)
   232 			{
   252 			{
   233 			// ASSUMPTIONS HERE
   253 			// ASSUMPTIONS HERE
   234 			// 1. root directory is past the end of the main ROM so there must be an extension ROM
   254 			// 1. root directory is past the end of the main ROM so there must be an extension ROM
   235 			// 2. the ROM file system in the extension ROM is at the beginning of the ROM (similar to the
   255 			// 2. the ROM file system in the extension ROM is at the beginning of the ROM (similar to the
   236 			//    main ROM)
   256 			//    main ROM)
   237 			// 3. the extension ROM is mapped starting at a megabyte boundary
   257 			// 3. the extension ROM is mapped starting at a megabyte boundary
   238 			// Thus the address of the extension ROM header may be obtained by rounding the root directory
   258 			// Thus the address of the extension ROM header may be obtained by rounding the root directory
   239 			// address down to the next megabyte boundary.
   259 			// address down to the next megabyte boundary.
   240          
   260 
   241  			TUint ext_start = rda &~ 0x000fffffu;
   261  			TUint ext_start = rda &~ 0x000fffffu;
   242 			TRomExceptionSearchTable* extrom_exctab = (TRomExceptionSearchTable*)(((TExtensionRomHeader*)ext_start)->iRomExceptionSearchTable);
   262 			TRomExceptionSearchTable* extrom_exctab = (TRomExceptionSearchTable*)(((TExtensionRomHeader*)ext_start)->iRomExceptionSearchTable);
   243 			if (extrom_exctab && addr >= extrom_exctab->iEntries[0] && addr < GET_EST_FENCEPOST(extrom_exctab))
   263 			if (extrom_exctab && addr >= extrom_exctab->iEntries[0] && addr < GET_EST_FENCEPOST(extrom_exctab))
   244 				aEDp = SearchEST(addr, extrom_exctab);
   264 				aEDp = SearchEST(addr, extrom_exctab);
   245 			}
   265 			}
   313 class TestOverflowTruncate8 : public TDes8Overflow
   333 class TestOverflowTruncate8 : public TDes8Overflow
   314 	{
   334 	{
   315 public:
   335 public:
   316 	virtual void Overflow(TDes8& /*aDes*/) {}
   336 	virtual void Overflow(TDes8& /*aDes*/) {}
   317 	};
   337 	};
   318 	
   338 
   319 #endif
   339 #endif
   320 
   340 
   321 void DebugPrintf(const char * aFmt, ...)
   341 void DebugPrintf(const char * aFmt, ...)
   322 	{
   342 	{
   323 #ifdef _DEBUG
   343 #ifdef _DEBUG
   331 	buf2.Copy(buf);
   351 	buf2.Copy(buf);
   332 	if (buf2[buf2.Length()-1]=='\n') buf2.Append('\r');
   352 	if (buf2[buf2.Length()-1]=='\n') buf2.Append('\r');
   333 	RDebug::RawPrint(buf2);
   353 	RDebug::RawPrint(buf2);
   334 #else
   354 #else
   335 	(void)aFmt;
   355 	(void)aFmt;
   336 #endif		
   356 #endif
   337 	}
   357 	}
   338 
   358 
   339 } // extern "C"
   359 } // extern "C"