RTEMS 6.1-rc1
Data Structures | Macros | Functions
check.c File Reference

Stack Overflow Check User Extension Set. More...

#include <rtems.h>
#include <inttypes.h>
#include <string.h>
#include <stdlib.h>
#include <rtems/bspIo.h>
#include <rtems/printer.h>
#include <rtems/stackchk.h>
#include <rtems/sysinit.h>
#include <rtems/score/address.h>
#include <rtems/score/percpu.h>
#include <rtems/score/smp.h>
#include <rtems/score/threadimpl.h>

Data Structures

struct  Stack_check_Visitor
 

Macros

#define CPU_STACK_CHECK_PATTERN_INITIALIZER
 
#define BYTE_PATTERN   0xA5
 
#define U32_PATTERN   0xA5A5A5A5
 
#define SANITY_PATTERN_SIZE_BYTES   sizeof(Stack_check_Sanity_pattern)
 
#define SANITY_PATTERN_SIZE_WORDS   RTEMS_ARRAY_SIZE(Stack_check_Sanity_pattern)
 
#define Stack_check_Get_pattern(_the_stack)
 
#define Stack_check_Calculate_used(_low, _size, _high_water)    ((char *)(_high_water) - (char *)(_low))
 
#define Stack_check_Usable_stack_start(_the_stack)    ((_the_stack)->area)
 
#define Stack_check_Usable_stack_size(_the_stack)    ((_the_stack)->size - SANITY_PATTERN_SIZE_BYTES)
 

Functions

bool rtems_stack_checker_create_extension (Thread_Control *running RTEMS_UNUSED, Thread_Control *the_thread)
 
void rtems_stack_checker_begin_extension (Thread_Control *executing)
 
void rtems_stack_checker_switch_extension (Thread_Control *running, Thread_Control *heir)
 Stack Checker Task Context Switch Extension. More...
 
bool rtems_stack_checker_is_blown (void)
 Checks if current task is blown its stack. More...
 
void rtems_stack_checker_report_usage_with_plugin (const rtems_printer *printer)
 Print the stack usage report using caller's routine. More...
 
void rtems_stack_checker_report_usage (void)
 Print the stack usage report using printk. More...
 
void rtems_stack_checker_iterate (rtems_stack_checker_visitor visit, void *arg)
 Iterates over all stacks used by the system and invokes the visitor routine for each stack. More...
 
 RTEMS_SYSINIT_ITEM (Stack_check_Prepare_interrupt_stacks, RTEMS_SYSINIT_ISR_STACK, RTEMS_SYSINIT_ORDER_MIDDLE)
 

Detailed Description

Stack Overflow Check User Extension Set.

NOTE: This extension set automatically determines at initialization time whether the stack for this CPU grows up or down and installs the correct extension routines for that direction.

Macro Definition Documentation

◆ CPU_STACK_CHECK_PATTERN_INITIALIZER

#define CPU_STACK_CHECK_PATTERN_INITIALIZER
Value:
{ \
0xFEEDF00D, 0x0BAD0D06, /* FEED FOOD to BAD DOG */ \
0xDEADF00D, 0x600D0D06 /* DEAD FOOD but GOOD DOG */ \
}

◆ Stack_check_Get_pattern

#define Stack_check_Get_pattern (   _the_stack)
Value:
((char *)(_the_stack)->area + \
(_the_stack)->size - SANITY_PATTERN_SIZE_BYTES )
unsigned size
Definition: tte.h:1