diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2011-04-21 19:05:15 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2011-04-21 19:05:15 +0000 |
commit | d7c388321ad2f250cb35f01dc4c8dda7489c3416 (patch) | |
tree | 292c6c350e7f96ddb3cc0a910433ceb296c24db1 /cpukit/score/src/threaddisabledispatch.c | |
parent | 2011-04-21 Jennifer Averett <Jennifer.Averett@OARcorp.com (diff) | |
download | rtems-d7c388321ad2f250cb35f01dc4c8dda7489c3416.tar.bz2 |
2011-04-21 Jennifer Averett <Jennifer.Averett@OARcorp.com
PR 1777/cpukit
* libcsupport/src/malloc_deferred.c, libcsupport/src/realloc.c,
score/Makefile.am, score/cpu/lm32/irq.c, score/cpu/nios2/irq.c,
score/include/rtems/score/coremutex.h,
score/include/rtems/score/thread.h,
score/inline/rtems/score/thread.inl, score/src/heapfree.c,
score/src/pheapwalk.c, score/src/smp.c, score/src/threaddispatch.c:
Consolidated access to _Thread_Dispatch_disable_level.
* score/src/threaddisabledispatch.c, score/src/threadenabledispatch.c:
New files.
Diffstat (limited to 'cpukit/score/src/threaddisabledispatch.c')
-rw-r--r-- | cpukit/score/src/threaddisabledispatch.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/cpukit/score/src/threaddisabledispatch.c b/cpukit/score/src/threaddisabledispatch.c new file mode 100644 index 0000000000..ea2b6fd73b --- /dev/null +++ b/cpukit/score/src/threaddisabledispatch.c @@ -0,0 +1,54 @@ +/* + * _Thread_Disable_dispatch + * + * + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <rtems/system.h> +#include <rtems/score/thread.h> + +#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ ) +void _Thread_Disable_dispatch( void ) +{ + /* + * This check is very brutal to system performance but is very helpful + * at finding blown stack problems. If you have a stack problem and + * need help finding it, then uncomment this code. Every system + * call will check the stack and since mutexes are used frequently + * in most systems, you might get lucky. + */ + #if defined(RTEMS_HEAVY_STACK_DEBUG) + if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) { + if ( rtems_stack_checker_is_blown() ) { + printk( "Stack blown!!\n" ); + rtems_fatal_error_occurred( 99 ); + } + } + #endif + + _Thread_Dispatch_increment_disable_level(); + RTEMS_COMPILER_MEMORY_BARRIER(); + + /* + * This check is even more brutal than the other one. This enables + * malloc heap integrity checking upon entry to every system call. + */ + #if defined(RTEMS_HEAVY_MALLOC_DEBUG) + if ( _Thread_Dispatch_get_disable_level() == 1 ) { + _Heap_Walk( RTEMS_Malloc_Heap,99, false ); + } + #endif +} +#endif |