From 4b9ddca40c842fc09ebf164c795b77613d9377a8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 23 Aug 2010 07:59:38 +0000 Subject: 2010-08-23 Sebastian Huber PR 1671/cpukit * libcsupport/include/rtems/gxx_wrappers.h: New file. * libcsupport/Makefile.am, libcsupport/preinstall.am: Reflect change above. * libcsupport/src/gxx_wrappers.c: Include . Use _Internal_error_Occurred() instead of rtems_panic(). * score/include/rtems/score/interr.h: Added INTERNAL_ERROR_GXX_KEY_ADD_FAILED and INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED. --- cpukit/libcsupport/Makefile.am | 3 +- cpukit/libcsupport/include/rtems/gxx_wrappers.h | 78 +++++++++++++++++++++++++ cpukit/libcsupport/preinstall.am | 4 ++ cpukit/libcsupport/src/gxx_wrappers.c | 33 ++++------- 4 files changed, 96 insertions(+), 22 deletions(-) create mode 100755 cpukit/libcsupport/include/rtems/gxx_wrappers.h (limited to 'cpukit/libcsupport') diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am index acd864a290..73dc5209b6 100644 --- a/cpukit/libcsupport/Makefile.am +++ b/cpukit/libcsupport/Makefile.am @@ -23,7 +23,8 @@ include_rtems_motorola_HEADERS = include/motorola/mc68230.h \ ## rtems include_rtems_HEADERS += include/rtems/assoc.h include/rtems/error.h \ include/rtems/libcsupport.h include/rtems/libio.h include/rtems/libio_.h \ - include/rtems/malloc.h include/rtems/termiostypes.h + include/rtems/malloc.h include/rtems/termiostypes.h \ + include/rtems/gxx_wrappers.h ## zilog diff --git a/cpukit/libcsupport/include/rtems/gxx_wrappers.h b/cpukit/libcsupport/include/rtems/gxx_wrappers.h new file mode 100755 index 0000000000..d4d4aae799 --- /dev/null +++ b/cpukit/libcsupport/include/rtems/gxx_wrappers.h @@ -0,0 +1,78 @@ +/* + * RTEMS threads compatibility routines for libgcc2. + * + * by: Rosimildo da Silva (rdasilva@connecttel.com) + * + * Used ideas from: + * W. Eric Norum + * Canadian Light Source + * University of Saskatchewan + * Saskatoon, Saskatchewan, CANADA + * eric@cls.usask.ca + * + * Eric sent some e-mail in the rtems-list as a start point for this + * module implementation. + * + * $Id$ + */ + +#ifndef __GCC_WRAPPERS_h +#define __GCC_WRAPPERS_h + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * These typedefs should match with the ones defined in the file + * gcc/gthr-rtems.h in the gcc distribution. + * FIXME: T.S, 2007/01/31: -> gcc/gthr-rtems.h still declares + * void * __gthread_key_t; + */ +typedef struct __gthread_key_ { + void *val; /* this is switched with the task */ + void (*dtor)(void*); /* this remains in place for all tasks */ +} __gthread_key, *__gthread_key_t; + +typedef int __gthread_once_t; +typedef void *__gthread_mutex_t; +typedef void *__gthread_recursive_mutex_t; + +int rtems_gxx_once(__gthread_once_t *once, void (*func) (void)); + +int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *)); + +int rtems_gxx_key_dtor (__gthread_key_t key, void *ptr); + +int rtems_gxx_key_delete (__gthread_key_t key); + +void *rtems_gxx_getspecific(__gthread_key_t key); + +int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr); + +/* + * MUTEX support + */ +void rtems_gxx_mutex_init (__gthread_mutex_t *mutex); + +int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex); + +int rtems_gxx_mutex_destroy (__gthread_mutex_t *mutex); + +int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex); + +int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex); + +void rtems_gxx_recursive_mutex_init(__gthread_recursive_mutex_t *mutex); + +int rtems_gxx_recursive_mutex_lock(__gthread_recursive_mutex_t *mutex); + +int rtems_gxx_recursive_mutex_trylock(__gthread_recursive_mutex_t *mutex); + +int rtems_gxx_recursive_mutex_unlock(__gthread_recursive_mutex_t *mutex); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __GCC_WRAPPERS_h */ diff --git a/cpukit/libcsupport/preinstall.am b/cpukit/libcsupport/preinstall.am index 88bfc98bd7..f71362fe31 100644 --- a/cpukit/libcsupport/preinstall.am +++ b/cpukit/libcsupport/preinstall.am @@ -95,6 +95,10 @@ $(PROJECT_INCLUDE)/rtems/termiostypes.h: include/rtems/termiostypes.h $(PROJECT_ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/termiostypes.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/termiostypes.h +$(PROJECT_INCLUDE)/rtems/gxx_wrappers.h: include/rtems/gxx_wrappers.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/gxx_wrappers.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/gxx_wrappers.h + $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp): @$(MKDIR_P) $(PROJECT_INCLUDE)/rtems/zilog @: > $(PROJECT_INCLUDE)/rtems/zilog/$(dirstamp) diff --git a/cpukit/libcsupport/src/gxx_wrappers.c b/cpukit/libcsupport/src/gxx_wrappers.c index 924b506831..9bd33e29e2 100644 --- a/cpukit/libcsupport/src/gxx_wrappers.c +++ b/cpukit/libcsupport/src/gxx_wrappers.c @@ -25,32 +25,15 @@ #include "config.h" #endif +#include + #include -#include #include -#include -#include -#include /* uncomment this if you need to debug this interface */ /*#define DEBUG_GXX_WRAPPERS 1*/ -/* - * These typedefs should match with the ones defined in the file - * gcc/gthr-rtems.h in the gcc distribution. - * FIXME: T.S, 2007/01/31: -> gcc/gthr-rtems.h still declares - * void * __gthread_key_t; - */ -typedef struct __gthread_key_ { - void *val; /* this is switched with the task */ - void (*dtor)(void*); /* this remains in place for all tasks */ -} __gthread_key, *__gthread_key_t; - -typedef int __gthread_once_t; -typedef void *__gthread_mutex_t; -typedef void *__gthread_recursive_mutex_t; - int rtems_gxx_once(__gthread_once_t *once, void (*func) (void)) { #ifdef DEBUG_GXX_WRAPPERS @@ -145,7 +128,11 @@ void *rtems_gxx_getspecific(__gthread_key_t key) */ status = rtems_task_variable_add( RTEMS_SELF, (void **)key, key->dtor ); if ( status != RTEMS_SUCCESSFUL ) { - rtems_panic ("rtems_gxx_getspecific"); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + true, + INTERNAL_ERROR_GXX_KEY_ADD_FAILED + ); } key->val = (void *)0; } @@ -212,7 +199,11 @@ void rtems_gxx_mutex_init (__gthread_mutex_t *mutex) status ); #endif - rtems_panic ("rtems_gxx_mutex_init"); + _Internal_error_Occurred( + INTERNAL_ERROR_CORE, + true, + INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED + ); } #ifdef DEBUG_GXX_WRAPPERS printk( "gxx_wrappers: mutex init complete =%X\n", *mutex ); -- cgit v1.2.3