1 /* 2 * ThreadX C++ Library Support 3 * 4 * Copyright 1983-2019 Green Hills Software LLC. 5 * 6 * This program is the property of Green Hills Software LLC., 7 * its contents are proprietary information and no part of it 8 * is to be disclosed to anyone except employees of Green Hills 9 * Software LLC., or as agreed in writing signed by the President 10 * of Green Hills Software LLC. 11 */ 12 #include "tx_ghs.h" 13 #ifndef TX_DISABLE_ERROR_CHECKING 14 #define TX_DISABLE_ERROR_CHECKING 15 #endif 16 #include "tx_api.h" 17 18 /* 19 C++ Exception Handling 20 ====================== 21 22 These routines allow C++ exceptions to be used in multiple threads. 23 The default implementation uses __ghs_GetThreadLocalStorageItem 24 to return a thread-specific __eh_globals pointer. 25 26 */ 27 28 #if defined(__ghs) && (__GHS_VERSION_NUMBER >= 560) 29 #ifdef _WIN32 30 /* Windows uses a different linker, so include a stub routine, never called, 31 to pull in __cpp_exception_init and __cpp_exception_cleanup */ 32 extern void __cpp_exception_init(void **); 33 extern void __cpp_exception_cleanup(void **); __tx_win32_pull_in_exceptions(void)34void __tx_win32_pull_in_exceptions(void) { 35 __cpp_exception_init(0); 36 __cpp_exception_cleanup(0); 37 } 38 #else 39 #pragma ghs reference __cpp_exception_init 40 #pragma ghs reference __cpp_exception_cleanup 41 #endif 42 43 /* Must be called after __cpp_exception_init() is called to allocate 44 * and initialize the per-thread exception handling structure */ __get_eh_globals(void)45void *__get_eh_globals(void) 46 { 47 return *(void **)__ghs_GetThreadLocalStorageItem(__ghs_TLS___eh_globals); 48 } 49 #endif 50