RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
29extern "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
158void *_Stack_Allocate( size_t stack_size );
159
167void _Stack_Free( void *stack_area );
168
171#ifdef __cplusplus
172}
173#endif
174
175#endif
176/* end of include file */
Information About Each Thread's Context.
Information About the Thread Stack Handler.
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
#define CONTEXT_FP_SIZE
Size of floating point context area.
Definition: context.h:52
RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum(void)
Returns the minimum stack size.
Definition: stackimpl.h:67
void _Stack_Free(void *stack_area)
Free the stack area allocated by _Stack_Allocate().
Definition: threadstackfree.c:25
RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum(size_t size)
Returns the appropriate stack size for the requested size.
Definition: stackimpl.h:114
RTEMS_INLINE_ROUTINE 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
RTEMS_INLINE_ROUTINE 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
void * _Stack_Allocate(size_t stack_size)
Allocate the requested stack space.
Definition: threadstackallocate.c:25
uint32_t rtems_minimum_stack_size
The minimum stack size.
RTEMS_INLINE_ROUTINE 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
uintptr_t _TLS_Get_allocation_size(void)
Return the TLS area allocation size.
Definition: tlsallocsize.c:36
Definition: stack.h:53
size_t size
Definition: stack.h:55
void * area
Definition: stack.h:57
unsigned size
Definition: tte.h:1
Thread-Local Storage (TLS)