diff --git a/cpukit/include/rtems/stackchk.h b/cpukit/include/rtems/stackchk.h index ca9c6fc040..02d6753b33 100644 --- a/cpukit/include/rtems/stackchk.h +++ b/cpukit/include/rtems/stackchk.h @@ -132,23 +132,6 @@ typedef struct { * UINTPTR_MAX. */ uintptr_t used; - - /** - * This member points to the currently executing thread which is being - * context switched out. - */ - const rtems_tcb *running; - - /** - * This member points to the next executing thread which will be - * context switched out. - */ - const rtems_tcb *heir; - - /** - * This member checks if the pattern is still valid or not. - */ - bool pattern_ok; } rtems_stack_checker_info; /** @@ -223,20 +206,30 @@ void rtems_stack_checker_switch_extension( /** * @brief A Quiet Version of Stack Checker Reporter. * - * @param[in] info is the stack information. + * @param[in] running running points to the currently executing thread which + * is being context switched out. + * + * @param[in] pattern_ok bool variable to check if the pattern is + * still valid or not */ void rtems_stack_checker_reporter_quiet( - const rtems_stack_checker_info *info + const rtems_tcb *running, + bool pattern_ok ); /** * @brief The Default Function to Report a Blown Stack. * - * @param[in] info is the stack information. + * @param[in] running running points to the currently executing thread which + * is being context switched out. + * + * @param[in] pattern_ok bool variable to check if the pattern is + * still valid or not */ void rtems_stack_checker_reporter_print_details( - const rtems_stack_checker_info *info + const rtems_tcb *running, + bool pattern_ok ); /** @@ -261,10 +254,15 @@ void rtems_stack_checker_reporter_print_details( /** * @brief The Stack Checker Reporter Initialization Handler. * - * @param[in] info is the stack information. + * @param[in] running running points to the currently executing thread which + * is being context switched out. + * + * @param[in] pattern_ok bool variable to check if the pattern is + * still valid or not. */ typedef void (*Stack_checker_Reporter_handler)( - const rtems_stack_checker_info *info + const rtems_tcb *running, + bool pattern_ok ); /** diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c index 7d751b5840..f1a25e93ba 100644 --- a/cpukit/libmisc/stackchk/check.c +++ b/cpukit/libmisc/stackchk/check.c @@ -262,21 +262,22 @@ void rtems_stack_checker_begin_extension( Thread_Control *executing ) * the following message out. */ void rtems_stack_checker_reporter_print_details( - const rtems_stack_checker_info *info + const Thread_Control *running, + bool pattern_ok ) { - const Stack_Control *stack = &info->running->Start.Initial_stack; + const Stack_Control *stack = &running->Start.Initial_stack; void *pattern_area = Stack_check_Get_pattern(stack); char name[2 * THREAD_DEFAULT_MAXIMUM_NAME_SIZE]; printk("BLOWN STACK!!!\n"); - printk("task control block: 0x%08" PRIxPTR "\n", (intptr_t) info->running); - printk("task ID: 0x%08lx\n", (unsigned long) info->running->Object.id); + printk("task control block: 0x%08" PRIxPTR "\n", (intptr_t) running); + printk("task ID: 0x%08lx\n", (unsigned long) running->Object.id); printk( "task name: 0x%08" PRIx32 "\n", - info->running->Object.name.name_u32 + running->Object.name.name_u32 ); - _Thread_Get_name(info->running, name, sizeof(name)); + _Thread_Get_name(running, name, sizeof(name)); printk("task name string: %s\n", name); printk( "task stack area (%lu Bytes): 0x%08" PRIxPTR " .. 0x%08" PRIxPTR "\n", @@ -284,7 +285,7 @@ void rtems_stack_checker_reporter_print_details( (intptr_t) stack->area, (intptr_t) ((char *) stack->area + stack->size) ); - if (!info->pattern_ok) { + if (!pattern_ok) { printk( "damaged pattern area (%lu Bytes): 0x%08" PRIxPTR " .. 0x%08" PRIxPTR "\n", (unsigned long) SANITY_PATTERN_SIZE_BYTES, @@ -304,17 +305,18 @@ void rtems_stack_checker_reporter_print_details( rtems_fatal( RTEMS_FATAL_SOURCE_STACK_CHECKER, - info->running->Object.name.name_u32 + running->Object.name.name_u32 ); } void rtems_stack_checker_reporter_quiet( - const rtems_stack_checker_info *info + const Thread_Control *running, + bool pattern_ok ) { rtems_fatal( RTEMS_FATAL_SOURCE_STACK_CHECKER, - info->running->Object.name.name_u32 + running->Object.name.name_u32 ); } @@ -327,12 +329,9 @@ void rtems_stack_checker_switch_extension( ) { bool sp_ok; + bool pattern_ok; const Stack_Control *stack; - rtems_stack_checker_info info; - info.running = running; - info.heir = heir; - /* * Check for an out of bounds stack pointer or an overwrite */ @@ -340,28 +339,24 @@ void rtems_stack_checker_switch_extension( sp_ok = Stack_check_Frame_pointer_in_range( heir ); if ( !sp_ok ) { - info.pattern_ok = Stack_check_Is_sanity_pattern_valid( + pattern_ok = Stack_check_Is_sanity_pattern_valid( &heir->Start.Initial_stack ); - Stack_checker_Reporter( &info ); + Stack_checker_Reporter( heir, pattern_ok ); } - info.pattern_ok = Stack_check_Is_sanity_pattern_valid( - &running->Start.Initial_stack - ); + pattern_ok = Stack_check_Is_sanity_pattern_valid( &running->Start.Initial_stack ); - if ( !info.pattern_ok ) { - Stack_checker_Reporter( &info ); + if ( !pattern_ok ) { + Stack_checker_Reporter( running, pattern_ok ); } #else sp_ok = Stack_check_Frame_pointer_in_range( running ); - info.pattern_ok = Stack_check_Is_sanity_pattern_valid( - &running->Start.Initial_stack - ); + pattern_ok = Stack_check_Is_sanity_pattern_valid( &running->Start.Initial_stack ); - if ( !sp_ok || !info.pattern_ok ) { - Stack_checker_Reporter( &info ); + if ( !sp_ok || !pattern_ok ) { + Stack_checker_Reporter( running, pattern_ok ); } #endif diff --git a/testsuites/libtests/stackchk03/config.c b/testsuites/libtests/stackchk03/config.c index 77416e8c9c..3e307b1325 100644 --- a/testsuites/libtests/stackchk03/config.c +++ b/testsuites/libtests/stackchk03/config.c @@ -37,11 +37,11 @@ #endif #include -#include /* functions */ void stackchk03_blown_stack_reporter( - const rtems_stack_checker_info *info + const Thread_Control *running, + bool pattern_ok ); const char rtems_test_name[] = "STACKCHK03"; diff --git a/testsuites/libtests/stackchk03/reporter.c b/testsuites/libtests/stackchk03/reporter.c index 565e592258..e573dd0ad2 100644 --- a/testsuites/libtests/stackchk03/reporter.c +++ b/testsuites/libtests/stackchk03/reporter.c @@ -37,20 +37,21 @@ #include #include #include -#include void stackchk03_blown_stack_reporter( - const rtems_stack_checker_info *info + const Thread_Control *running, + bool pattern_ok ); void stackchk03_blown_stack_reporter( - const rtems_stack_checker_info *info + const Thread_Control *running, + bool pattern_ok ) { /* custom stack report funtion to be implemented here */ printk("RTEMS STACKCHK03 CUSTOM REPORTER !!!\n"); rtems_fatal( RTEMS_FATAL_SOURCE_STACK_CHECKER, - info->running->Object.name.name_u32 + running->Object.name.name_u32 ); }