RTEMS  5.1
Files | Data Structures | Macros | Typedefs | Functions | Variables
Stack Handler

Stack Handler. More...

Files

file  stack.h
 Information About the Thread Stack Handler.
 
file  stackimpl.h
 Inlined Routines from the Stack Handler.
 
file  threadstackallocate.c
 Stack Allocate Helper.
 
file  threadstackfree.c
 Deallocate Thread Stack.
 

Data Structures

struct  Stack_Control
 

Macros

#define STACK_MINIMUM_SIZE   CPU_STACK_MINIMUM_SIZE
 

Typedefs

typedef void(* Stack_Allocator_initialize) (size_t stack_space_size)
 The stack allocator initialization handler. More...
 
typedef void *(* Stack_Allocator_allocate) (size_t stack_size)
 Stack allocator allocate handler. More...
 
typedef void(* Stack_Allocator_free) (void *addr)
 Stack allocator free handler. More...
 

Functions

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. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum (void)
 Returns the minimum stack size. More...
 
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. More...
 
RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum (size_t size)
 Returns the appropriate stack size for the requested size. More...
 
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 thread. More...
 
void * _Stack_Allocate (size_t stack_size)
 Allocate the requested stack space. More...
 
void _Stack_Free (void *stack_area)
 Free the stack area allocated by _Stack_Allocate(). More...
 

Variables

uint32_t rtems_minimum_stack_size
 The minimum stack size. More...
 
const uintptr_t _Stack_Space_size
 The configured stack space size. More...
 
const bool _Stack_Allocator_avoids_workspace
 Indicates if the stack allocator avoids the workspace. More...
 
const Stack_Allocator_initialize _Stack_Allocator_initialize
 The stack allocator initialization handler. More...
 
const Stack_Allocator_allocate _Stack_Allocator_allocate
 The stack allocator allocate handler. More...
 
const Stack_Allocator_free _Stack_Allocator_free
 The stack allocator free handler. More...
 

Detailed Description

Stack Handler.

This handler encapsulates functionality which is used in the management of thread stacks.

Macro Definition Documentation

◆ STACK_MINIMUM_SIZE

#define STACK_MINIMUM_SIZE   CPU_STACK_MINIMUM_SIZE

The following constant defines the minimum stack size which every thread must exceed.

Typedef Documentation

◆ Stack_Allocator_allocate

typedef void*( * Stack_Allocator_allocate) (size_t stack_size)

Stack allocator allocate handler.

Parameters
stack_sizeThe size of the stack area to allocate in bytes.
Return values
NULLNot enough memory.
otherPointer to begin of stack area.

◆ Stack_Allocator_free

typedef void( * Stack_Allocator_free) (void *addr)

Stack allocator free handler.

Parameters
]addr A pointer to previously allocated stack area or NULL.

◆ Stack_Allocator_initialize

typedef void( * Stack_Allocator_initialize) (size_t stack_space_size)

The stack allocator initialization handler.

Parameters
stack_space_sizeThe size of the stack space in bytes.

Function Documentation

◆ _Stack_Allocate()

void* _Stack_Allocate ( size_t  stack_size)

Allocate the requested stack space.

Parameters
stack_sizeThe stack space that is requested.
Return values
stack_areaThe allocated stack area.
NULLThe allocation failed.

◆ _Stack_Ensure_minimum()

RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum ( size_t  size)

Returns the appropriate stack size for the requested size.

This function returns the appropriate stack size given the requested size. If the requested size is below the minimum, then the minimum configured stack size is returned.

Parameters
sizeThe stack size to check.
Returns
The appropriate stack size.

◆ _Stack_Extend_size()

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 thread.

Parameters
stack_sizeThe stack size.
is_fpIndicates if the stack is for a floating-point thread.
Returns
The extended stack size.

◆ _Stack_Free()

void _Stack_Free ( void *  stack_area)

Free the stack area allocated by _Stack_Allocate().

Do nothing if the stack area is NULL.

Parameters
stack_areaThe stack area to free, or NULL.

◆ _Stack_Initialize()

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.

This routine initializes the_stack record to indicate that size bytes of memory starting at starting_address have been reserved for a stack.

Parameters
[out]the_stackThe stack to initialize.
starting_addressThe starting_address for the new stack.
sizeThe size of the stack in bytes.

◆ _Stack_Is_enough()

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.

This function returns true if size bytes is enough memory for a valid stack area on this processor, and false otherwise.

Parameters
sizeThe stack size to check.
is_fpIndicates if the stack is for a floating-point thread.
Return values
truesize is large enough.
falsesize is not large enough.

◆ _Stack_Minimum()

RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum ( void  )

Returns the minimum stack size.

This function returns the minimum stack size configured for this application.

Returns
The minimum stack size.

Variable Documentation

◆ _Stack_Allocator_allocate

const Stack_Allocator_allocate _Stack_Allocator_allocate

The stack allocator allocate handler.

Application provided via <rtems/confdefs.h>.

◆ _Stack_Allocator_avoids_workspace

const bool _Stack_Allocator_avoids_workspace

Indicates if the stack allocator avoids the workspace.

Application provided via <rtems/confdefs.h>.

◆ _Stack_Allocator_free

const Stack_Allocator_free _Stack_Allocator_free

The stack allocator free handler.

Application provided via <rtems/confdefs.h>.

◆ _Stack_Allocator_initialize

const Stack_Allocator_initialize _Stack_Allocator_initialize

The stack allocator initialization handler.

Application provided via <rtems/confdefs.h>.

◆ _Stack_Space_size

const uintptr_t _Stack_Space_size

The configured stack space size.

Application provided via <rtems/confdefs.h>.

◆ rtems_minimum_stack_size

uint32_t rtems_minimum_stack_size

The minimum stack size.

Application provided via <rtems/confdefs.h>.