1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Disaable Thread Dispatching |
---|
5 | * @ingroup ScoreThread |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * |
---|
10 | * |
---|
11 | * COPYRIGHT (c) 1989-2011. |
---|
12 | * On-Line Applications Research Corporation (OAR). |
---|
13 | * |
---|
14 | * The license and distribution terms for this file may be |
---|
15 | * found in the file LICENSE in this distribution or at |
---|
16 | * http://www.rtems.org/license/LICENSE. |
---|
17 | */ |
---|
18 | |
---|
19 | #if HAVE_CONFIG_H |
---|
20 | #include "config.h" |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <rtems/system.h> |
---|
24 | #include <rtems/score/sysstate.h> |
---|
25 | #include <rtems/score/thread.h> |
---|
26 | #include <rtems/score/threaddispatch.h> |
---|
27 | |
---|
28 | #if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ ) |
---|
29 | void _Thread_Disable_dispatch( void ) |
---|
30 | { |
---|
31 | /* |
---|
32 | * This check is very brutal to system performance but is very helpful |
---|
33 | * at finding blown stack problems. If you have a stack problem and |
---|
34 | * need help finding it, then uncomment this code. Every system |
---|
35 | * call will check the stack and since mutexes are used frequently |
---|
36 | * in most systems, you might get lucky. |
---|
37 | */ |
---|
38 | #if defined(RTEMS_HEAVY_STACK_DEBUG) |
---|
39 | if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) { |
---|
40 | if ( rtems_stack_checker_is_blown() ) { |
---|
41 | printk( "Stack blown!!\n" ); |
---|
42 | rtems_fatal_error_occurred( 99 ); |
---|
43 | } |
---|
44 | } |
---|
45 | #endif |
---|
46 | |
---|
47 | _Thread_Dispatch_increment_disable_level(); |
---|
48 | RTEMS_COMPILER_MEMORY_BARRIER(); |
---|
49 | |
---|
50 | /* |
---|
51 | * This check is even more brutal than the other one. This enables |
---|
52 | * malloc heap integrity checking upon entry to every system call. |
---|
53 | */ |
---|
54 | #if defined(RTEMS_HEAVY_MALLOC_DEBUG) |
---|
55 | if ( _Thread_Dispatch_get_disable_level() == 1 ) { |
---|
56 | _Heap_Walk( RTEMS_Malloc_Heap,99, false ); |
---|
57 | } |
---|
58 | #endif |
---|
59 | } |
---|
60 | #endif |
---|