RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
check.c File Reference

This file contains the 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_reporter_print_details (const Thread_Control *running, bool pattern_ok)
 The Default Function to Report a Blown Stack.
 
void rtems_stack_checker_reporter_quiet (const Thread_Control *running, bool pattern_ok)
 A Quiet Version of Stack Checker Reporter.
 
void rtems_stack_checker_switch_extension (Thread_Control *running, Thread_Control *heir)
 Stack Checker Task Context Switch Extension.
 
bool rtems_stack_checker_is_blown (void)
 Checks if current task is blown its stack.
 
void rtems_stack_checker_report_usage_with_plugin (const rtems_printer *printer)
 Print the stack usage report using caller's routine.
 
void rtems_stack_checker_report_usage (void)
 Print the stack usage report using printk.
 
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.
 
 RTEMS_SYSINIT_ITEM (Stack_check_Prepare_interrupt_stacks, RTEMS_SYSINIT_ISR_STACK, RTEMS_SYSINIT_ORDER_MIDDLE)
 

Detailed Description

This file contains the Stack Overflow Check user extension set.

Note
This extension set uses conditional compilation to account for stack growth 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 )