Changeset 3595533 in rtems


Ignore:
Timestamp:
Apr 11, 2012, 8:50:00 AM (8 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
13a8b19, 2947bae
Parents:
bc04436
git-author:
Sebastian Huber <sebastian.huber@…> (04/11/12 08:50:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/24/12 12:22:57)
Message:

score: Remove _Stack_Adjust_size()

The increase of the stack size by CPU_STACK_ALIGNMENT in
_Thread_Stack_Allocate() is disadvantageous. This may lead to a huge
over allocation for specialized stack allocators. The
CPU_STACK_ALIGNMENT is at most 16 on all current RTEMS CPU ports. The
mimimum stack size ensured by _Stack_Ensure_minimum() must be
considerable larger than this value, otherwise stack overflows will
likely occur. Thus the _Stack_Adjust_size() is also superfluous.

Location:
cpukit/score
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/inline/rtems/score/stack.inl

    rbc04436 r3595533  
    2525
    2626#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */
    27 #include <rtems/score/cpu.h> /* CPU_STACK_ALIGNMENT */
    2827
    2928/**
     
    9190}
    9291
    93 /**
    94  *  This function increases the stack size to ensure that the thread
    95  *  has the desired amount of stack space after the initial stack
    96  *  pointer is determined based on alignment restrictions.
    97  *
    98  *  @note
    99  *
    100  *  The amount of adjustment for alignment is CPU dependent.
    101  */
    102 
    103 RTEMS_INLINE_ROUTINE uint32_t   _Stack_Adjust_size (
    104   size_t size
    105 )
    106 {
    107   return size + CPU_STACK_ALIGNMENT;
    108 }
    109 
    11092/**@}*/
    11193
  • cpukit/score/src/threadstackallocate.c

    rbc04436 r3595533  
    5252  the_stack_size = _Stack_Ensure_minimum( stack_size );
    5353
    54   /*
    55    *  Pad the requested size so we allocate enough memory
    56    *  so the context initialization can align it properly.  The address
    57    *  returned the workspace allocate must be directly stored in the
    58    *  stack control block because it is later used in the free sequence.
    59    *
    60    *  Thus it is the responsibility of the CPU dependent code to
    61    *  get and keep the stack adjust factor, the stack alignment, and
    62    *  the context initialization sequence in sync.
    63    */
    64   the_stack_size = _Stack_Adjust_size( the_stack_size );
    65 
    6654  stack_addr = (*stack_allocate_hook)( the_stack_size );
    6755
Note: See TracChangeset for help on using the changeset viewer.