source: rtems/cpukit/score/inline/rtems/score/stack.inl @ 3595533

4.115
Last change on this file since 3595533 was 3595533, checked in by Sebastian Huber <sebastian.huber@…>, on 04/11/12 at 08:50:00

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.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2 *  @file  rtems/score/stack.inl
3 *
4 *  This file contains the static inline implementation of the inlined
5 *  routines from the Stack Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_STACK_H
20# error "Never use <rtems/score/stack.inl> directly; include <rtems/score/stack.h> instead."
21#endif
22
23#ifndef _RTEMS_SCORE_STACK_INL
24#define _RTEMS_SCORE_STACK_INL
25
26#include <rtems/score/basedefs.h> /* RTEMS_INLINE_ROUTINE */
27
28/**
29 *  @addtogroup ScoreStack
30 *  @{
31 */
32
33/**
34 *  This routine initializes the_stack record to indicate that
35 *  size bytes of memory starting at starting_address have been
36 *  reserved for a stack.
37 */
38RTEMS_INLINE_ROUTINE void _Stack_Initialize (
39  Stack_Control *the_stack,
40  void          *starting_address,
41  size_t         size
42)
43{
44  the_stack->area = starting_address;
45  the_stack->size = size;
46}
47
48/**
49 *  This function returns the minimum stack size configured
50 *  for this application.
51 *
52 *  @return This method returns the minimum stack size;
53 */
54RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum (void)
55{
56  return rtems_minimum_stack_size;
57}
58
59/**
60 *  This function returns true if size bytes is enough memory for
61 *  a valid stack area on this processor, and false otherwise.
62 *
63 *  @param[in] size is the stack size to check
64 *
65 *  @return This method returns true if the stack is large enough.
66 */
67RTEMS_INLINE_ROUTINE bool _Stack_Is_enough (
68  size_t size
69)
70{
71  return ( size >= _Stack_Minimum() );
72}
73
74/**
75 *  This function returns the appropriate stack size given the requested
76 *  size.  If the requested size is below the minimum, then the minimum
77 *  configured stack size is returned.
78 *
79 *  @param[in] size is the stack size to check
80 *
81 *  @return This method returns the appropriate stack size.
82 */
83RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum (
84  size_t size
85)
86{
87  if ( size >= _Stack_Minimum() )
88    return size;
89  return _Stack_Minimum();
90}
91
92/**@}*/
93
94#endif
95/* end of include file */
Note: See TracBrowser for help on using the repository browser.