2009-06-01 Joel Sherrill <joel.sherrill@OARcorp.com>

* score/include/rtems/score/thread.h, score/src/threadhandler.c: Merge
	conditional code from main and init/fini C++ constructors so the body
	of this method reads better. Mark thread prototypes which are not
	currently exercised by any APIs with
	FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API conditional.
This commit is contained in:
Joel Sherrill
2009-06-01 14:50:31 +00:00
parent 57be444e59
commit 46a67b1981
3 changed files with 66 additions and 58 deletions

View File

@@ -1,3 +1,11 @@
2009-06-01 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/include/rtems/score/thread.h, score/src/threadhandler.c: Merge
conditional code from main and init/fini C++ constructors so the body
of this method reads better. Mark thread prototypes which are not
currently exercised by any APIs with
FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API conditional.
2009-05-28 Joel Sherrill <joel.sherrill@OARcorp.com> 2009-05-28 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1415/cpukit PR 1415/cpukit

View File

@@ -99,8 +99,10 @@ typedef uintptr_t Thread_Entry_numeric_type;
typedef enum { typedef enum {
THREAD_START_NUMERIC, THREAD_START_NUMERIC,
THREAD_START_POINTER, THREAD_START_POINTER,
#if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
THREAD_START_BOTH_POINTER_FIRST, THREAD_START_BOTH_POINTER_FIRST,
THREAD_START_BOTH_NUMERIC_FIRST THREAD_START_BOTH_NUMERIC_FIRST
#endif
} Thread_Start_types; } Thread_Start_types;
/** This type corresponds to a very simple style thread entry point. */ /** This type corresponds to a very simple style thread entry point. */

View File

@@ -2,7 +2,7 @@
* Thread Handler * Thread Handler
* *
* *
* COPYRIGHT (c) 1989-2008. * COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR). * On-Line Applications Research Corporation (OAR).
* *
* The license and distribution terms for this file may be * The license and distribution terms for this file may be
@@ -42,9 +42,13 @@
#endif #endif
extern void INIT_NAME(void); extern void INIT_NAME(void);
#define EXECUTE_GLOBAL_CONSTRUCTORS
#endif #endif
#if defined(__USE__MAIN__) #if defined(__USE__MAIN__)
extern void _main(void); extern void _main(void);
#define INIT_NAME __main
#define EXECUTE_GLOBAL_CONSTRUCTORS
#endif #endif
/*PAGE /*PAGE
@@ -79,10 +83,10 @@ void _Thread_Handler( void )
{ {
ISR_Level level; ISR_Level level;
Thread_Control *executing; Thread_Control *executing;
#if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__) #if defined(EXECUTE_GLOBAL_CONSTRUCTORS)
static char doneConstructors; static char doneConstructors;
char doneCons; char doneCons;
#endif #endif
executing = _Thread_Executing; executing = _Thread_Executing;
@@ -101,78 +105,72 @@ void _Thread_Handler( void )
level = executing->Start.isr_level; level = executing->Start.isr_level;
_ISR_Set_level(level); _ISR_Set_level(level);
#if defined(__USE_INIT_FINI__) || defined(__USE__MAIN__) #if defined(EXECUTE_GLOBAL_CONSTRUCTORS)
doneCons = doneConstructors; doneCons = doneConstructors;
doneConstructors = 1; doneConstructors = 1;
#endif #endif
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
if ( (executing->fp_context != NULL) && !_Thread_Is_allocated_fp( executing ) ) { if ( (executing->fp_context != NULL) &&
!_Thread_Is_allocated_fp( executing ) ) {
if ( _Thread_Allocated_fp != NULL ) if ( _Thread_Allocated_fp != NULL )
_Context_Save_fp( &_Thread_Allocated_fp->fp_context ); _Context_Save_fp( &_Thread_Allocated_fp->fp_context );
_Thread_Allocated_fp = executing; _Thread_Allocated_fp = executing;
} }
#endif #endif
#endif #endif
/* /*
* Take care that 'begin' extensions get to complete before * Take care that 'begin' extensions get to complete before
* 'switch' extensions can run. This means must keep dispatch * 'switch' extensions can run. This means must keep dispatch
* disabled until all 'begin' extensions complete. * disabled until all 'begin' extensions complete.
*/ */
_User_extensions_Thread_begin( executing ); _User_extensions_Thread_begin( executing );
/* /*
* At this point, the dispatch disable level BETTER be 1. * At this point, the dispatch disable level BETTER be 1.
*/ */
_Thread_Enable_dispatch(); _Thread_Enable_dispatch();
#if defined(__USE_INIT_FINI__)
#if defined(EXECUTE_GLOBAL_CONSTRUCTORS)
/* /*
* _init could be a weak symbol and we SHOULD test it but it isn't * _init could be a weak symbol and we SHOULD test it but it isn't
* in any configuration I know of and it generates a warning on every * in any configuration I know of and it generates a warning on every
* RTEMS target configuration. --joel (12 May 2007) * RTEMS target configuration. --joel (12 May 2007)
*/ */
if (!doneCons) /* && (volatile void *)_init) */ if (!doneCons) /* && (volatile void *)_init) */ {
{
INIT_NAME (); INIT_NAME ();
} }
#endif #endif
#if defined(__USE__MAIN__)
if (!doneCons && _main)
__main ();
#endif
switch ( executing->Start.prototype ) { if ( executing->Start.prototype == THREAD_START_NUMERIC ) {
case THREAD_START_NUMERIC:
executing->Wait.return_argument = executing->Wait.return_argument =
(*(Thread_Entry_numeric) executing->Start.entry_point)( (*(Thread_Entry_numeric) executing->Start.entry_point)(
executing->Start.numeric_argument executing->Start.numeric_argument
); );
break; } else if ( executing->Start.prototype == THREAD_START_POINTER ) {
case THREAD_START_POINTER:
executing->Wait.return_argument = executing->Wait.return_argument =
(*(Thread_Entry_pointer) executing->Start.entry_point)( (*(Thread_Entry_pointer) executing->Start.entry_point)(
executing->Start.pointer_argument executing->Start.pointer_argument
); );
break; }
case THREAD_START_BOTH_POINTER_FIRST: #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API)
else if ( executing->Start.prototype == THREAD_START_BOTH_POINTER_FIRST ) {
executing->Wait.return_argument = executing->Wait.return_argument =
(*(Thread_Entry_both_pointer_first) executing->Start.entry_point)( (*(Thread_Entry_both_pointer_first) executing->Start.entry_point)(
executing->Start.pointer_argument, executing->Start.pointer_argument,
executing->Start.numeric_argument executing->Start.numeric_argument
); );
break; }
case THREAD_START_BOTH_NUMERIC_FIRST: else if ( executing->Start.prototype == THREAD_START_BOTH_NUMERIC_FIRST ) {
executing->Wait.return_argument = executing->Wait.return_argument =
(*(Thread_Entry_both_numeric_first) executing->Start.entry_point)( (*(Thread_Entry_both_numeric_first) executing->Start.entry_point)(
executing->Start.numeric_argument, executing->Start.numeric_argument,
executing->Start.pointer_argument executing->Start.pointer_argument
); );
break;
} }
#endif
/* /*
* In the switch above, the return code from the user thread body * In the switch above, the return code from the user thread body