RTEMS
stackimpl.h
Go to the documentation of this file.
1 
12 /*
13  * COPYRIGHT (c) 1989-2006.
14  * On-Line Applications Research Corporation (OAR).
15  *
16  * The license and distribution terms for this file may be
17  * found in the file LICENSE in this distribution or at
18  * http://www.rtems.org/license/LICENSE.
19  */
20 
21 #ifndef _RTEMS_SCORE_STACKIMPL_H
22 #define _RTEMS_SCORE_STACKIMPL_H
23 
24 #include <rtems/score/stack.h>
25 #include <rtems/score/context.h>
26 #include <rtems/score/tls.h>
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
50  Stack_Control *the_stack,
51  void *starting_address,
52  size_t size
53 )
54 {
55  the_stack->area = starting_address;
56  the_stack->size = size;
57 }
58 
68 {
70 }
71 
85  size_t size,
86  bool is_fp
87 )
88 {
89  size_t minimum;
90 
91  minimum = _TLS_Get_allocation_size();
92  minimum += _Stack_Minimum();
93 
94 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
95  if ( is_fp ) {
96  minimum += CONTEXT_FP_SIZE;
97  }
98 #endif
99 
100  return ( size >= minimum );
101 }
102 
115  size_t size
116 )
117 {
118  if ( size >= _Stack_Minimum() )
119  return size;
120  return _Stack_Minimum();
121 }
122 
133  size_t stack_size,
134  bool is_fp
135 )
136 {
137 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
138  if ( is_fp ) {
139  stack_size += CONTEXT_FP_SIZE;
140  }
141 #else
142  (void) is_fp;
143 #endif
144 
145  stack_size += _TLS_Get_allocation_size();
146 
147  return stack_size;
148 }
149 
158 void *_Stack_Allocate( size_t stack_size );
159 
167 void _Stack_Free( void *stack_area );
168 
174 void _Stack_Free_nothing( void *stack_area );
175 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif
183 /* end of include file */
Thread-Local Storage (TLS)
uintptr_t _TLS_Get_allocation_size(void)
Return the TLS area allocation size.
Definition: tlsallocsize.c:38
Information About Each Thread&#39;s Context.
static __inline__ void _Stack_Initialize(Stack_Control *the_stack, void *starting_address, size_t size)
Initializes stack with the given starting address and size.
Definition: stackimpl.h:49
#define CONTEXT_FP_SIZE
Size of floating point context area.
Definition: context.h:52
void _Stack_Free(void *stack_area)
Free the stack area allocated by _Stack_Allocate().
static __inline__ uint32_t _Stack_Minimum(void)
Returns the minimum stack size.
Definition: stackimpl.h:67
void _Stack_Free_nothing(void *stack_area)
This function does nothing.
static __inline__ bool _Stack_Is_enough(size_t size, bool is_fp)
Checks if the size is enough for a valid stack area on this processor.
Definition: stackimpl.h:84
size_t size
Definition: stack.h:55
uint32_t rtems_minimum_stack_size
The minimum stack size.
void * _Stack_Allocate(size_t stack_size)
Allocate the requested stack space.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
Definition: basedefs.h:683
static __inline__ size_t _Stack_Ensure_minimum(size_t size)
Returns the appropriate stack size for the requested size.
Definition: stackimpl.h:114
void * area
Definition: stack.h:57
Information About the Thread Stack Handler.
static __inline__ size_t _Stack_Extend_size(size_t stack_size, bool is_fp)
Extend the stack size to account for additional data structures allocated in the stack area of a thre...
Definition: stackimpl.h:132