diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-09-13 21:00:11 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-09-13 21:00:11 +0000 |
commit | bacf79e0b981e9e3796fb6e3a9d9b39ed476d60d (patch) | |
tree | 149a46b35388ce0a3acfcfdc909f45546e4a7bb8 | |
parent | 2009-09-13 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-bacf79e0b981e9e3796fb6e3a9d9b39ed476d60d.tar.bz2 |
2009-09-13 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/include/rtems/score/thread.h, score/src/threadinitialize.c,
score/src/threadstackfree.c: Disable capability for API to let user
provide thread stack when no API configured includes this capability.
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 17 | ||||
-rw-r--r-- | cpukit/score/src/threadinitialize.c | 22 | ||||
-rw-r--r-- | cpukit/score/src/threadstackfree.c | 23 |
4 files changed, 43 insertions, 25 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 866c4e9453..14f660ecc5 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,11 @@ 2009-09-13 Joel Sherrill <joel.sherrill@oarcorp.com> + * score/include/rtems/score/thread.h, score/src/threadinitialize.c, + score/src/threadstackfree.c: Disable capability for API to let user + provide thread stack when no API configured includes this capability. + +2009-09-13 Joel Sherrill <joel.sherrill@oarcorp.com> + * score/include/rtems/score/coresem.h, score/src/coresemseize.c: Disable body of _CORE_semaphore_Seize() if it is not used because all APIs using it are disabled. diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 5d3dc43634..ed5b475cd1 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -35,6 +35,9 @@ #define RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT #endif +#if defined(RTEMS_POSIX_API) + #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API +#endif #ifdef __cplusplus extern "C" { @@ -218,14 +221,16 @@ typedef struct { uint32_t isr_level; /** This field is the initial priority. */ Priority_Control initial_priority; - /** This field indicates whether the SuperCore allocated the stack. */ - bool core_allocated_stack; + #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API) + /** This field indicates whether the SuperCore allocated the stack. */ + bool core_allocated_stack; + #endif /** This field is the stack information. */ Stack_Control Initial_stack; -#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) - /** This field is the initial FP context area address. */ - Context_Control_fp *fp_context; -#endif + #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) + /** This field is the initial FP context area address. */ + Context_Control_fp *fp_context; + #endif /** This field is the initial stack area address. */ void *stack; } Thread_Start_information; diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c index c41983fc34..2f7cf370be 100644 --- a/cpukit/score/src/threadinitialize.c +++ b/cpukit/score/src/threadinitialize.c @@ -87,18 +87,26 @@ bool _Thread_Initialize( /* * Allocate and Initialize the stack for this thread. */ - if ( !stack_area ) { + #if !defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API) actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size ); if ( !actual_stack_size || actual_stack_size < stack_size ) return false; /* stack allocation failed */ stack = the_thread->Start.stack; - the_thread->Start.core_allocated_stack = true; - } else { - stack = stack_area; - actual_stack_size = stack_size; - the_thread->Start.core_allocated_stack = false; - } + #else + if ( !stack_area ) { + actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size ); + if ( !actual_stack_size || actual_stack_size < stack_size ) + return false; /* stack allocation failed */ + + stack = the_thread->Start.stack; + the_thread->Start.core_allocated_stack = true; + } else { + stack = stack_area; + actual_stack_size = stack_size; + the_thread->Start.core_allocated_stack = false; + } + #endif _Stack_Initialize( &the_thread->Start.Initial_stack, diff --git a/cpukit/score/src/threadstackfree.c b/cpukit/score/src/threadstackfree.c index ba376b8972..beede76793 100644 --- a/cpukit/score/src/threadstackfree.c +++ b/cpukit/score/src/threadstackfree.c @@ -41,23 +41,22 @@ void _Thread_Stack_Free( Thread_Control *the_thread ) { + #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API) /* * If the API provided the stack space, then don't free it. */ - if ( !the_thread->Start.core_allocated_stack ) return; + #endif - /* - * Call ONLY the CPU table stack free hook, or the - * the RTEMS workspace free. This is so the free - * routine properly matches the allocation of the stack. - */ + /* + * Call ONLY the CPU table stack free hook, or the + * the RTEMS workspace free. This is so the free + * routine properly matches the allocation of the stack. + */ - if ( Configuration.stack_free_hook ) - (*Configuration.stack_free_hook)( - the_thread->Start.Initial_stack.area - ); - else - _Workspace_Free( the_thread->Start.Initial_stack.area ); + if ( Configuration.stack_free_hook ) + (*Configuration.stack_free_hook)( the_thread->Start.Initial_stack.area ); + else + _Workspace_Free( the_thread->Start.Initial_stack.area ); } |