RTEMS
Files | Classes | 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  stackallocatorfreenothing.c
 _Stack_Free_nothing() Implementation
 
file  threadstackallocate.c
 Stack Allocate Helper.
 

Classes

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

void _Stack_Allocator_do_initialize (void)
 Do the stack allocator initialization during system initialize. More...
 
static __inline__ void _Stack_Initialize (Stack_Control *the_stack, void *starting_address, size_t size)
 Initializes stack with the given starting address and size. More...
 
static __inline__ uint32_t _Stack_Minimum (void)
 Returns the minimum stack size. More...
 
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. More...
 
static __inline__ size_t _Stack_Ensure_minimum (size_t size)
 Returns the appropriate stack size for the requested size. More...
 
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 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...
 
void _Stack_Free_nothing (void *stack_area)
 This function does nothing. 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.

Definition at line 48 of file stack.h.

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.

Definition at line 75 of file stack.h.

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

Definition at line 82 of file stack.h.

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

Definition at line 65 of file stack.h.

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.

Definition at line 25 of file threadstackallocate.c.

◆ _Stack_Allocator_do_initialize()

void _Stack_Allocator_do_initialize ( void  )

Do the stack allocator initialization during system initialize.

This function is used to initialize application provided stack allocators.

◆ _Stack_Ensure_minimum()

static __inline__ size_t _Stack_Ensure_minimum ( size_t  size)
static

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.

Definition at line 114 of file stackimpl.h.

◆ _Stack_Extend_size()

static __inline__ size_t _Stack_Extend_size ( size_t  stack_size,
bool  is_fp 
)
static

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.

Definition at line 132 of file stackimpl.h.

◆ _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_Free_nothing()

void _Stack_Free_nothing ( void *  stack_area)

This function does nothing.

Parameters
stack_areais not used.

Definition at line 42 of file stackallocatorfreenothing.c.

◆ _Stack_Initialize()

static __inline__ void _Stack_Initialize ( Stack_Control the_stack,
void *  starting_address,
size_t  size 
)
static

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.

Definition at line 49 of file stackimpl.h.

◆ _Stack_Is_enough()

static __inline__ bool _Stack_Is_enough ( size_t  size,
bool  is_fp 
)
static

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.

Definition at line 84 of file stackimpl.h.

◆ _Stack_Minimum()

static __inline__ uint32_t _Stack_Minimum ( void  )
static

Returns the minimum stack size.

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

Returns
The minimum stack size.

Definition at line 67 of file stackimpl.h.

Variable Documentation

◆ _Stack_Allocator_allocate

const Stack_Allocator_allocate _Stack_Allocator_allocate

The stack allocator allocate handler.

Application provided via <rtems/confdefs.h>.

Definition at line 37 of file stackallocator.c.

◆ _Stack_Allocator_avoids_workspace

const bool _Stack_Allocator_avoids_workspace

Indicates if the stack allocator avoids the workspace.

Application provided via <rtems/confdefs.h>.

Definition at line 35 of file stackallocator.c.

◆ _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>.