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/include/rtems/gxx_wrappers.h | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 cpukit/libcsupport/include/rtems/gxx_wrappers.h (limited to 'cpukit/libcsupport/include/rtems/gxx_wrappers.h') 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 */ -- cgit v1.2.3