diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-08-23 07:59:38 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-08-23 07:59:38 +0000 |
commit | 4b9ddca40c842fc09ebf164c795b77613d9377a8 (patch) | |
tree | 789aea46a16061b2f84372c01190ffa501c1bf27 /cpukit | |
parent | 2010-08-23 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-4b9ddca40c842fc09ebf164c795b77613d9377a8.tar.bz2 |
2010-08-23 Sebastian Huber <sebastian.huber@embedded-brains.de>
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 <rtems/gxx_wrappers.h>. 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.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 12 | ||||
-rw-r--r-- | cpukit/libcsupport/Makefile.am | 3 | ||||
-rwxr-xr-x | cpukit/libcsupport/include/rtems/gxx_wrappers.h | 78 | ||||
-rw-r--r-- | cpukit/libcsupport/preinstall.am | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/gxx_wrappers.c | 33 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/interr.h | 4 |
6 files changed, 111 insertions, 23 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index ea4fdb5554..26c11faa63 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,15 @@ +2010-08-23 Sebastian Huber <sebastian.huber@embedded-brains.de> + + 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 <rtems/gxx_wrappers.h>. 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. + 2010-08-20 <yann.sionneau@telecom-sudparis.eu> * libmisc/fb/fb.h: Add constants for buffer modes. 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 <rtems/gxx_wrappers.h> + #include <stdlib.h> -#include <stdio.h> #include <rtems.h> -#include <rtems/system.h> -#include <rtems/error.h> -#include <rtems/rtems/tasks.h> /* 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 ); diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index d3ee532f4d..b98eba8d7a 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -70,7 +70,9 @@ typedef enum { INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL, INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE, INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0, - INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP + INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP, + INTERNAL_ERROR_GXX_KEY_ADD_FAILED, + INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED } Internal_errors_Core_list; typedef uint32_t Internal_errors_t; |