Changeset bacf79e in rtems


Ignore:
Timestamp:
Sep 13, 2009, 9:00:11 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
46605724
Parents:
8907a01c
Message:

2009-09-13 Joel Sherrill <joel.sherrill@…>

  • 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.
Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r8907a01c rbacf79e  
     12009-09-13      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * score/include/rtems/score/thread.h, score/src/threadinitialize.c,
     4        score/src/threadstackfree.c: Disable capability for API to let user
     5        provide thread stack when no API configured includes this capability.
     6
    172009-09-13      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • cpukit/score/include/rtems/score/thread.h

    r8907a01c rbacf79e  
    3636#endif
    3737
     38#if defined(RTEMS_POSIX_API)
     39  #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
     40#endif
    3841
    3942#ifdef __cplusplus
     
    219222  /** This field is the initial priority. */
    220223  Priority_Control                     initial_priority;
    221   /** This field indicates whether the SuperCore allocated the stack. */
    222   bool                                 core_allocated_stack;
     224  #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
     225    /** This field indicates whether the SuperCore allocated the stack. */
     226    bool                                 core_allocated_stack;
     227  #endif
    223228  /** This field is the stack information. */
    224229  Stack_Control                        Initial_stack;
    225 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
    226   /** This field is the initial FP context area address. */
    227   Context_Control_fp                  *fp_context;
    228 #endif
     230  #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
     231    /** This field is the initial FP context area address. */
     232    Context_Control_fp                  *fp_context;
     233  #endif
    229234  /** This field is the initial stack area address. */
    230235  void                                *stack;
  • cpukit/score/src/threadinitialize.c

    r8907a01c rbacf79e  
    8888   *  Allocate and Initialize the stack for this thread.
    8989   */
    90   if ( !stack_area ) {
     90  #if !defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
    9191    actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size );
    9292    if ( !actual_stack_size || actual_stack_size < stack_size )
     
    9494
    9595    stack = the_thread->Start.stack;
    96     the_thread->Start.core_allocated_stack = true;
    97   } else {
    98     stack = stack_area;
    99     actual_stack_size = stack_size;
    100     the_thread->Start.core_allocated_stack = false;
    101   }
     96  #else
     97    if ( !stack_area ) {
     98      actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size );
     99      if ( !actual_stack_size || actual_stack_size < stack_size )
     100        return false;                     /* stack allocation failed */
     101
     102      stack = the_thread->Start.stack;
     103      the_thread->Start.core_allocated_stack = true;
     104    } else {
     105      stack = stack_area;
     106      actual_stack_size = stack_size;
     107      the_thread->Start.core_allocated_stack = false;
     108    }
     109  #endif
    102110
    103111  _Stack_Initialize(
  • cpukit/score/src/threadstackfree.c

    r8907a01c rbacf79e  
    4242)
    4343{
     44  #if defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
    4445    /*
    4546     *  If the API provided the stack space, then don't free it.
    4647     */
    47 
    4848    if ( !the_thread->Start.core_allocated_stack )
    4949      return;
     50  #endif
    5051
    51     /*
    52      * Call ONLY the CPU table stack free hook, or the
    53      * the RTEMS workspace free.  This is so the free
    54      * routine properly matches the allocation of the stack.
    55      */
     52  /*
     53   * Call ONLY the CPU table stack free hook, or the
     54   * the RTEMS workspace free.  This is so the free
     55   * routine properly matches the allocation of the stack.
     56   */
    5657
    57     if ( Configuration.stack_free_hook )
    58       (*Configuration.stack_free_hook)(
    59         the_thread->Start.Initial_stack.area
    60       );
    61     else
    62         _Workspace_Free( the_thread->Start.Initial_stack.area );
     58  if ( Configuration.stack_free_hook )
     59    (*Configuration.stack_free_hook)( the_thread->Start.Initial_stack.area );
     60  else
     61    _Workspace_Free( the_thread->Start.Initial_stack.area );
    6362}
Note: See TracChangeset for help on using the changeset viewer.