-
? testsuites/support/include/.tmacros.h.swp
RCS file: /usr1/CVS/rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c,v
retrieving revision 1.8
diff -u -r1.8 panic.c
|
|
|
101 | 101 | printk(" UNKNOWN (0x%x)\n",THESRC); |
102 | 102 | break; |
103 | 103 | } |
104 | | if ( _Thread_Dispatch_disable_level ) |
| 104 | if ( _Thread_Dispatch_in_critical_section() ) |
105 | 105 | printk( |
106 | 106 | " Error occurred in a Thread Dispatching DISABLED context (level %i)\n", |
107 | | _Thread_Dispatch_disable_level); |
| 107 | _Thread_Dispatch_get_disable_level()); |
108 | 108 | else |
109 | 109 | printk("enabled\n"); |
110 | 110 | |
-
RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c,v
retrieving revision 1.18
diff -u -r1.18 cpu_asm.c
|
|
|
134 | 134 | |
135 | 135 | _ISR_Disable( level ); |
136 | 136 | |
137 | | _Thread_Dispatch_disable_level++; |
| 137 | _Thread_Dispatch_increment_disable_level(); |
138 | 138 | |
139 | 139 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
140 | 140 | if ( _ISR_Nest_level == 0 ) |
… |
… |
|
156 | 156 | |
157 | 157 | _ISR_Disable( level ); |
158 | 158 | |
159 | | _Thread_Dispatch_disable_level--; |
| 159 | _Thread_Dispatch_decrement_disable_level(); |
160 | 160 | |
161 | 161 | _ISR_Nest_level--; |
162 | 162 | |
… |
… |
|
172 | 172 | if ( _ISR_Nest_level ) |
173 | 173 | return; |
174 | 174 | |
175 | | if ( _Thread_Dispatch_disable_level ) { |
| 175 | if ( _Thread_Dispatch_in_critical_section() ) { |
176 | 176 | return; |
177 | 177 | } |
178 | 178 | |
-
RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c,v
retrieving revision 1.20
diff -u -r1.20 cpu_asm.c
|
|
|
136 | 136 | |
137 | 137 | _ISR_Disable( level ); |
138 | 138 | |
139 | | _Thread_Dispatch_disable_level++; |
| 139 | _Thread_Dispatch_increment_disable_level(); |
140 | 140 | |
141 | 141 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
142 | 142 | if ( _ISR_Nest_level == 0 ) |
… |
… |
|
158 | 158 | |
159 | 159 | _ISR_Disable( level ); |
160 | 160 | |
161 | | _Thread_Dispatch_disable_level--; |
| 161 | _Thread_Dispatch_decrement_disable_level(); |
162 | 162 | |
163 | 163 | _ISR_Nest_level--; |
164 | 164 | |
… |
… |
|
174 | 174 | if ( _ISR_Nest_level ) |
175 | 175 | return; |
176 | 176 | |
177 | | if ( _Thread_Dispatch_disable_level ) { |
| 177 | if ( _Thread_Dispatch_in_critical_section() ) { |
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
-
RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/sh7750/score/cpu_asm.c,v
retrieving revision 1.16
diff -u -r1.16 cpu_asm.c
|
|
|
60 | 60 | |
61 | 61 | _ISR_Disable( level ); |
62 | 62 | |
63 | | _Thread_Dispatch_disable_level++; |
| 63 | _Thread_Dispatch_increment_disable_level(); |
64 | 64 | |
65 | 65 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
66 | 66 | if ( _ISR_Nest_level == 0 ) |
… |
… |
|
82 | 82 | |
83 | 83 | _ISR_Disable( level ); |
84 | 84 | |
85 | | _Thread_Dispatch_disable_level--; |
| 85 | _Thread_Dispatch_decrement_disable_level(); |
86 | 86 | |
87 | 87 | _ISR_Nest_level--; |
88 | 88 | |
… |
… |
|
97 | 97 | if ( _ISR_Nest_level ) |
98 | 98 | return; |
99 | 99 | |
100 | | if ( _Thread_Dispatch_disable_level ) { |
| 100 | if ( _Thread_Dispatch_in_critical_section() ) { |
101 | 101 | return; |
102 | 102 | } |
103 | 103 | |
-
RCS file: /usr1/CVS/rtems/c/src/lib/libcpu/sh/shgdb/score/cpu_asm.c,v
retrieving revision 1.5
diff -u -r1.5 cpu_asm.c
|
|
|
33 | 33 | |
34 | 34 | _ISR_Disable( level ); |
35 | 35 | |
36 | | _Thread_Dispatch_disable_level++; |
| 36 | _Thread_Dispatch_increment_disable_level(); |
37 | 37 | |
38 | 38 | #if (CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
39 | 39 | if ( _ISR_Nest_level == 0 ) |
… |
… |
|
55 | 55 | |
56 | 56 | _ISR_Disable( level ); |
57 | 57 | |
58 | | _Thread_Dispatch_disable_level--; |
| 58 | _Thread_Dispatch_decrement_disable_level(); |
59 | 59 | |
60 | 60 | _ISR_Nest_level--; |
61 | 61 | |
… |
… |
|
71 | 71 | if ( _ISR_Nest_level ) |
72 | 72 | return; |
73 | 73 | |
74 | | if ( _Thread_Dispatch_disable_level ) { |
| 74 | if ( _Thread_Dispatch_in_critical_section() ) { |
75 | 75 | return; |
76 | 76 | } |
77 | 77 | |
-
RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/malloc_deferred.c,v
retrieving revision 1.4
diff -u -r1.4 malloc_deferred.c
|
|
|
26 | 26 | |
27 | 27 | bool malloc_is_system_state_OK(void) |
28 | 28 | { |
29 | | if ( _Thread_Dispatch_disable_level > 0 ) |
| 29 | if ( _Thread_Dispatch_in_critical_section() ) |
30 | 30 | return false; |
31 | 31 | |
32 | 32 | if ( _ISR_Nest_level > 0 ) |
-
RCS file: /usr1/CVS/rtems/cpukit/libcsupport/src/realloc.c,v
retrieving revision 1.7
diff -u -r1.7 realloc.c
|
|
|
35 | 35 | */ |
36 | 36 | |
37 | 37 | if (_System_state_Is_up(_System_state_Get())) { |
38 | | if (_Thread_Dispatch_disable_level > 0) |
| 38 | if (_Thread_Dispatch_in_critical_section()) |
39 | 39 | return (void *) 0; |
40 | 40 | |
41 | 41 | if (_ISR_Nest_level > 0) |
-
RCS file: /usr1/CVS/rtems/cpukit/score/Makefile.am,v
retrieving revision 1.95
diff -u -r1.95 Makefile.am
|
|
|
189 | 189 | libscore_a_SOURCES += src/thread.c src/threadchangepriority.c \ |
190 | 190 | src/threadclearstate.c src/threadclose.c src/threadcreateidle.c \ |
191 | 191 | src/threaddelayended.c src/threaddispatch.c \ |
| 192 | src/threadenabledispatch.c src/threaddisabledispatch.c \ |
192 | 193 | src/threadget.c src/threadhandler.c src/threadinitialize.c \ |
193 | 194 | src/threadloadenv.c src/threadready.c src/threadreset.c \ |
194 | 195 | src/threadrestart.c src/threadsetpriority.c \ |
-
RCS file: /usr1/CVS/rtems/cpukit/score/cpu/lm32/irq.c,v
retrieving revision 1.7
diff -u -r1.7 irq.c
|
|
|
44 | 44 | |
45 | 45 | /* Interrupts are disabled upon entry to this Handler */ |
46 | 46 | |
47 | | _Thread_Dispatch_disable_level++; |
| 47 | _Thread_Dispatch_increment_disable_level(); |
48 | 48 | |
49 | 49 | #if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) |
50 | 50 | if ( _ISR_Nest_level == 0 ) { |
… |
… |
|
71 | 71 | stack_ptr = _old_stack_ptr; |
72 | 72 | #endif |
73 | 73 | |
74 | | _Thread_Dispatch_disable_level--; |
| 74 | _Thread_Dispatch_decrement_disable_level(); |
75 | 75 | |
76 | 76 | _CPU_ISR_Enable( level ); |
77 | 77 | |
-
RCS file: /usr1/CVS/rtems/cpukit/score/cpu/nios2/irq.c,v
retrieving revision 1.8
diff -u -r1.8 irq.c
|
|
|
50 | 50 | |
51 | 51 | _ISR_Nest_level++; |
52 | 52 | |
53 | | _Thread_Dispatch_disable_level++; |
| 53 | _Thread_Dispatch_increment_disable_level(); |
54 | 54 | |
55 | 55 | if ( _ISR_Vector_table[ vector] ) |
56 | 56 | { |
… |
… |
|
60 | 60 | /* Make sure that interrupts are disabled again */ |
61 | 61 | _CPU_ISR_Disable( level ); |
62 | 62 | |
63 | | _Thread_Dispatch_disable_level--; |
| 63 | _Thread_Dispatch_decrement_disable_level(); |
64 | 64 | |
65 | 65 | _ISR_Nest_level--; |
66 | 66 | |
… |
… |
|
69 | 69 | stack_ptr = _old_stack_ptr; |
70 | 70 | #endif |
71 | 71 | |
72 | | if( _Thread_Dispatch_disable_level == 0 ) |
| 72 | if( !_Thread_Dispatch_in_critical_section() ) |
73 | 73 | { |
74 | 74 | if ( _Thread_Dispatch_necessary ) { |
75 | 75 | _CPU_ISR_Enable( level ); |
-
RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/coremutex.h,v
retrieving revision 1.42
diff -u -r1.42 coremutex.h
|
|
|
368 | 368 | #define _CORE_mutex_Seize_body( \ |
369 | 369 | _the_mutex, _id, _wait, _timeout, _level ) \ |
370 | 370 | do { \ |
371 | | if ( _Thread_Dispatch_disable_level \ |
| 371 | if ( _Thread_Dispatch_in_critical_section() \ |
372 | 372 | && (_wait) \ |
373 | 373 | && (_System_state_Get() >= SYSTEM_STATE_BEGIN_MULTITASKING ) \ |
374 | 374 | ) { \ |
-
RCS file: /usr1/CVS/rtems/cpukit/score/include/rtems/score/thread.h,v
retrieving revision 1.100
diff -u -r1.100 thread.h
|
|
|
46 | 46 | #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API |
47 | 47 | #endif |
48 | 48 | |
| 49 | #if defined(RTEMS_SMP) || \ |
| 50 | defined(RTEMS_HEAVY_STACK_DEBUG) || \ |
| 51 | defined(RTEMS_HEAVY_MALLOC_DEBUG) |
| 52 | #define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ |
| 53 | #endif |
| 54 | |
| 55 | #if defined(RTEMS_SMP) || \ |
| 56 | (CPU_INLINE_ENABLE_DISPATCH == FALSE) || \ |
| 57 | (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) |
| 58 | #define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ |
| 59 | #endif |
| 60 | |
49 | 61 | #ifdef __cplusplus |
50 | 62 | extern "C" { |
51 | 63 | #endif |
-
RCS file: /usr1/CVS/rtems/cpukit/score/inline/rtems/score/thread.inl,v
retrieving revision 1.44
diff -u -r1.44 thread.inl
|
|
|
32 | 32 | */ |
33 | 33 | |
34 | 34 | /** |
| 35 | * This routine returns true if thread dispatch indicates |
| 36 | * that we are in a critical section. |
| 37 | */ |
| 38 | RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void) |
| 39 | { |
| 40 | if ( _Thread_Dispatch_disable_level == 0 ) |
| 41 | return false; |
| 42 | |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * This routine returns value of the the thread dispatch level. |
| 48 | */ |
| 49 | RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void) |
| 50 | { |
| 51 | return _Thread_Dispatch_disable_level; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * This routine sets thread dispatch level to the |
| 56 | * value passed in. |
| 57 | */ |
| 58 | RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value) |
| 59 | { |
| 60 | _Thread_Dispatch_disable_level = value; |
| 61 | return value; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * This rountine increments the thread dispatch level |
| 66 | */ |
| 67 | RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void) |
| 68 | { |
| 69 | _Thread_Dispatch_disable_level++; |
| 70 | return _Thread_Dispatch_disable_level; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * This routine decrements the thread dispatch level. |
| 75 | */ |
| 76 | RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void) |
| 77 | { |
| 78 | _Thread_Dispatch_disable_level--; |
| 79 | return _Thread_Dispatch_disable_level; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | /** |
35 | 84 | * This routine halts multitasking and returns control to |
36 | 85 | * the "thread" (i.e. the BSP) which initially invoked the |
37 | 86 | * routine which initialized the system. |
… |
… |
|
150 | 199 | * This routine prevents dispatching. |
151 | 200 | */ |
152 | 201 | |
| 202 | #if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ ) |
| 203 | void _Thread_Disable_dispatch( void ); |
| 204 | #else |
| 205 | |
153 | 206 | #if defined(RTEMS_HEAVY_STACK_DEBUG) || defined(RTEMS_HEAVY_MALLOC_DEBUG) |
154 | 207 | #include <rtems/bspIo.h> |
155 | 208 | #include <rtems/fatal.h> |
… |
… |
|
163 | 216 | */ |
164 | 217 | extern Heap_Control *RTEMS_Malloc_Heap; |
165 | 218 | #endif |
166 | | |
167 | 219 | RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void ) |
168 | 220 | { |
169 | 221 | /* |
… |
… |
|
182 | 234 | } |
183 | 235 | #endif |
184 | 236 | |
185 | | _Thread_Dispatch_disable_level += 1; |
| 237 | _Thread_Dispatch_increment_disable_level(); |
186 | 238 | RTEMS_COMPILER_MEMORY_BARRIER(); |
187 | 239 | |
188 | 240 | /* |
… |
… |
|
190 | 242 | * malloc heap integrity checking upon entry to every system call. |
191 | 243 | */ |
192 | 244 | #if defined(RTEMS_HEAVY_MALLOC_DEBUG) |
193 | | if ( _Thread_Dispatch_disable_level == 1 ) { |
| 245 | if ( Thread_Dispatch_disable_level_value() == 1 ) { |
194 | 246 | _Heap_Walk( RTEMS_Malloc_Heap,99, false ); |
195 | 247 | } |
196 | 248 | #endif |
197 | 249 | } |
| 250 | #endif |
198 | 251 | |
199 | 252 | /** |
200 | 253 | * This routine allows dispatching to occur again. If this is |
… |
… |
|
203 | 256 | * processor will be transferred to the heir thread. |
204 | 257 | */ |
205 | 258 | |
206 | | #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \ |
207 | | (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \ |
208 | | (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) ) |
209 | | void _Thread_Enable_dispatch( void ); |
| 259 | #if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ ) |
| 260 | void _Thread_Enable_dispatch( void ); |
210 | 261 | #else |
211 | | /* inlining of enable dispatching must be true */ |
212 | | RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void ) |
213 | | { |
214 | | RTEMS_COMPILER_MEMORY_BARRIER(); |
215 | | if ( (--_Thread_Dispatch_disable_level) == 0 ) |
216 | | _Thread_Dispatch(); |
217 | | } |
| 262 | /* inlining of enable dispatching must be true */ |
| 263 | RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void ) |
| 264 | { |
| 265 | RTEMS_COMPILER_MEMORY_BARRIER(); |
| 266 | if ( Thread_Dispatch_disable_level_Decrement() == 0 ) |
| 267 | _Thread_Dispatch(); |
| 268 | } |
218 | 269 | #endif |
219 | 270 | |
220 | | |
221 | 271 | /** |
222 | 272 | * This routine allows dispatching to occur again. However, |
223 | 273 | * no dispatching operation is performed even if this is the outer |
… |
… |
|
227 | 277 | RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void ) |
228 | 278 | { |
229 | 279 | RTEMS_COMPILER_MEMORY_BARRIER(); |
230 | | _Thread_Dispatch_disable_level -= 1; |
| 280 | _Thread_Dispatch_decrement_disable_level(); |
231 | 281 | } |
232 | 282 | |
233 | 283 | /** |
… |
… |
|
237 | 287 | |
238 | 288 | RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void ) |
239 | 289 | { |
240 | | return ( _Thread_Dispatch_disable_level == 0 ); |
| 290 | return ( _Thread_Dispatch_in_critical_section() == false ); |
241 | 291 | } |
242 | 292 | |
243 | 293 | /** |
… |
… |
|
256 | 306 | |
257 | 307 | RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void ) |
258 | 308 | { |
259 | | _Thread_Dispatch_disable_level = 1; |
| 309 | _Thread_Dispatch_set_disable_level( 1 ); |
260 | 310 | } |
261 | 311 | |
262 | 312 | /** |
-
RCS file: /usr1/CVS/rtems/cpukit/score/src/heapfree.c,v
retrieving revision 1.15
diff -u -r1.15 heapfree.c
|
|
|
89 | 89 | * is the task stack of a thread that deletes itself. The thread dispatch |
90 | 90 | * disable level is a way to detect this use case. |
91 | 91 | */ |
92 | | if ( _Thread_Dispatch_disable_level == 0 ) { |
| 92 | if ( !_Thread_Dispatch_in_critical_section() ) { |
93 | 93 | Heap_Block *const next = block->Protection_begin.next_delayed_free_block; |
94 | 94 | if ( next == NULL ) { |
95 | 95 | _Heap_Protection_delay_block_free( heap, block ); |
-
RCS file: /usr1/CVS/rtems/cpukit/score/src/pheapwalk.c,v
retrieving revision 1.5
diff -u -r1.5 pheapwalk.c
|
|
|
39 | 39 | * |
40 | 40 | * NOTE: Dispatching is also disabled during initialization. |
41 | 41 | */ |
42 | | if ( !_Thread_Dispatch_disable_level ) { |
| 42 | if ( _Thread_Dispatch_in_critical_section() == false ) { |
43 | 43 | _RTEMS_Lock_allocator(); |
44 | 44 | status = _Heap_Walk( the_heap, source, do_dump ); |
45 | 45 | _RTEMS_Unlock_allocator(); |
-
RCS file: /usr1/CVS/rtems/cpukit/score/src/smp.c,v
retrieving revision 1.1
diff -u -r1.1 smp.c
|
|
|
37 | 37 | * This is definitely a hack until we have SMP scheduling. Since there |
38 | 38 | * is only one executing and heir right now, we have to fake this out. |
39 | 39 | */ |
40 | | _Thread_Dispatch_disable_level = 1; |
| 40 | _Thread_Dispatch_set_disable_level(1); |
41 | 41 | _Thread_Executing = heir; |
42 | 42 | _CPU_Context_switch_to_first_task_smp( &heir->Registers ); |
43 | 43 | } |
… |
… |
|
103 | 103 | |
104 | 104 | if ( message & RTEMS_BSP_SMP_SHUTDOWN ) { |
105 | 105 | ISR_Level level; |
106 | | _Thread_Dispatch_disable_level = 0; |
| 106 | _Thread_Dispatch_set_disable_level(0); |
107 | 107 | _Per_CPU_Information[cpu].isr_nest_level = 0; |
108 | 108 | _Per_CPU_Information[cpu].state = RTEMS_BSP_SMP_CPU_SHUTDOWN; |
109 | 109 | _ISR_Disable( level ); |
-
RCS file: cpukit/score/src/threaddisabledispatch.c
diff -N cpukit/score/src/threaddisabledispatch.c
-
|
+
|
|
| 1 | /* |
| 2 | * _Thread_Disable_dispatch |
| 3 | * |
| 4 | * |
| 5 | * COPYRIGHT (c) 1989-2011. |
| 6 | * On-Line Applications Research Corporation (OAR). |
| 7 | * |
| 8 | * The license and distribution terms for this file may be |
| 9 | * found in the file LICENSE in this distribution or at |
| 10 | * http://www.rtems.com/license/LICENSE. |
| 11 | * |
| 12 | * $Id$ |
| 13 | */ |
| 14 | |
| 15 | #if HAVE_CONFIG_H |
| 16 | #include "config.h" |
| 17 | #endif |
| 18 | |
| 19 | #include <rtems/system.h> |
| 20 | #include <rtems/score/thread.h> |
| 21 | |
| 22 | #if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ ) |
| 23 | void _Thread_Disable_dispatch( void ) |
| 24 | { |
| 25 | /* |
| 26 | * This check is very brutal to system performance but is very helpful |
| 27 | * at finding blown stack problems. If you have a stack problem and |
| 28 | * need help finding it, then uncomment this code. Every system |
| 29 | * call will check the stack and since mutexes are used frequently |
| 30 | * in most systems, you might get lucky. |
| 31 | */ |
| 32 | #if defined(RTEMS_HEAVY_STACK_DEBUG) |
| 33 | if (_System_state_Is_up(_System_state_Get()) && (_ISR_Nest_level == 0)) { |
| 34 | if ( rtems_stack_checker_is_blown() ) { |
| 35 | printk( "Stack blown!!\n" ); |
| 36 | rtems_fatal_error_occurred( 99 ); |
| 37 | } |
| 38 | } |
| 39 | #endif |
| 40 | |
| 41 | _Thread_Dispatch_increment_disable_level(); |
| 42 | RTEMS_COMPILER_MEMORY_BARRIER(); |
| 43 | |
| 44 | /* |
| 45 | * This check is even more brutal than the other one. This enables |
| 46 | * malloc heap integrity checking upon entry to every system call. |
| 47 | */ |
| 48 | #if defined(RTEMS_HEAVY_MALLOC_DEBUG) |
| 49 | if ( _Thread_Dispatch_get_disable_level() == 1 ) { |
| 50 | _Heap_Walk( RTEMS_Malloc_Heap,99, false ); |
| 51 | } |
| 52 | #endif |
| 53 | } |
| 54 | #endif |
-
RCS file: /usr1/CVS/rtems/cpukit/score/src/threaddispatch.c,v
retrieving revision 1.23
diff -u -r1.23 threaddispatch.c
|
|
|
1 | 1 | /* |
2 | 2 | * Thread Handler |
3 | 3 | * |
4 | | * |
5 | 4 | * COPYRIGHT (c) 1989-2009. |
6 | 5 | * On-Line Applications Research Corporation (OAR). |
7 | 6 | * |
… |
… |
|
34 | 33 | #include <rtems/score/timestamp.h> |
35 | 34 | #endif |
36 | 35 | |
37 | | /*PAGE |
38 | | * |
39 | | * _Thread_Enable_dispatch |
40 | | * |
41 | | * This kernel routine exits a context switch disable critical section. |
42 | | * This is the NOT INLINED version. |
43 | | * |
44 | | * Input parameters: NONE |
45 | | * |
46 | | * Output parameters: NONE |
47 | | * |
48 | | * INTERRUPT LATENCY: |
49 | | * dispatch thread |
50 | | * no dispatch thread |
51 | | */ |
52 | | |
53 | | #if ( (defined(CPU_INLINE_ENABLE_DISPATCH) && \ |
54 | | (CPU_INLINE_ENABLE_DISPATCH == FALSE)) || \ |
55 | | (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1) ) |
56 | | void _Thread_Enable_dispatch( void ) |
57 | | { |
58 | | if ( --_Thread_Dispatch_disable_level ) |
59 | | return; |
60 | | _Thread_Dispatch(); |
61 | | } |
62 | | #endif |
63 | | |
64 | | /*PAGE |
65 | | * |
| 36 | /** |
66 | 37 | * _Thread_Dispatch |
67 | 38 | * |
68 | 39 | * This kernel routine determines if a dispatch is needed, and if so |
… |
… |
|
72 | 43 | * ALTERNATE ENTRY POINTS: |
73 | 44 | * void _Thread_Enable_dispatch(); |
74 | 45 | * |
75 | | * Input parameters: NONE |
76 | | * |
77 | | * Output parameters: NONE |
78 | | * |
79 | 46 | * INTERRUPT LATENCY: |
80 | 47 | * dispatch thread |
81 | 48 | * no dispatch thread |
… |
… |
|
91 | 58 | _ISR_Disable( level ); |
92 | 59 | while ( _Thread_Dispatch_necessary == true ) { |
93 | 60 | heir = _Thread_Heir; |
94 | | _Thread_Dispatch_disable_level = 1; |
| 61 | _Thread_Dispatch_set_disable_level( 1 ); |
95 | 62 | _Thread_Dispatch_necessary = false; |
96 | 63 | _Thread_Executing = heir; |
97 | 64 | |
… |
… |
|
185 | 152 | } |
186 | 153 | |
187 | 154 | post_switch: |
188 | | _Thread_Dispatch_disable_level = 0; |
| 155 | _Thread_Dispatch_set_disable_level( 0 ); |
189 | 156 | |
190 | 157 | _ISR_Enable( level ); |
191 | 158 | |
-
RCS file: cpukit/score/src/threadenabledispatch.c
diff -N cpukit/score/src/threadenabledispatch.c
-
|
+
|
|
| 1 | /* |
| 2 | * _Thread_Enable_dispatch |
| 3 | * |
| 4 | * |
| 5 | * COPYRIGHT (c) 1989-2011. |
| 6 | * On-Line Applications Research Corporation (OAR). |
| 7 | * |
| 8 | * The license and distribution terms for this file may be |
| 9 | * found in the file LICENSE in this distribution or at |
| 10 | * http://www.rtems.com/license/LICENSE. |
| 11 | * |
| 12 | * $Id$ |
| 13 | */ |
| 14 | |
| 15 | #if HAVE_CONFIG_H |
| 16 | #include "config.h" |
| 17 | #endif |
| 18 | |
| 19 | #include <rtems/score/thread.h> |
| 20 | |
| 21 | #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__ |
| 22 | #include <rtems/score/timestamp.h> |
| 23 | #endif |
| 24 | |
| 25 | |
| 26 | /** |
| 27 | * The following declares the dispatch critical section nesting |
| 28 | * counter which is used to prevent context switches at inopportune |
| 29 | * moments. |
| 30 | */ |
| 31 | |
| 32 | /** |
| 33 | * _Thread_Enable_dispatch |
| 34 | * |
| 35 | * This kernel routine exits a context switch disable critical section. |
| 36 | * This is the NOT INLINED version. |
| 37 | * |
| 38 | * INTERRUPT LATENCY: |
| 39 | * dispatch thread |
| 40 | * no dispatch thread |
| 41 | */ |
| 42 | #if defined (__THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ ) |
| 43 | void _Thread_Enable_dispatch( void ) |
| 44 | { |
| 45 | if ( --_Thread_Dispatch_disable_level ) |
| 46 | return; |
| 47 | _Thread_Dispatch(); |
| 48 | } |
| 49 | #endif |
-
RCS file: /usr1/CVS/rtems/testsuites/support/include/tmacros.h,v
retrieving revision 1.55
diff -u -r1.55 tmacros.h
|
|
|
25 | 25 | #include <string.h> |
26 | 26 | #include <rtems/error.h> |
27 | 27 | #include <rtems/score/thread.h> /* _Thread_Dispatch_disable_level */ |
| 28 | #include <rtems/score/thread.inl> /* _Thread_Dispatch_disable_level */ |
28 | 29 | |
29 | 30 | #ifdef __cplusplus |
30 | 31 | extern "C" { |
… |
… |
|
48 | 49 | #define check_dispatch_disable_level( _expect ) \ |
49 | 50 | do { \ |
50 | 51 | if ( (_expect) != -1 \ |
51 | | && ((_Thread_Dispatch_disable_level == 0 && (_expect) != 0) \ |
52 | | || (_Thread_Dispatch_disable_level != 0 && (_expect) == 0)) \ |
| 52 | && ((_Thread_Dispatch_in_critical_section() == false && (_expect) != 0) \ |
| 53 | || (_Thread_Dispatch_in_critical_section() && (_expect) == 0)) \ |
53 | 54 | ) { \ |
54 | 55 | printk( \ |
55 | 56 | "\n_Thread_Dispatch_disable_level is (%" PRId32 \ |
56 | 57 | ") not %d detected at %s:%d\n", \ |
57 | | _Thread_Dispatch_disable_level, (_expect), __FILE__, __LINE__ ); \ |
| 58 | _Thread_Dispatch_get_disable_level(), (_expect), __FILE__, __LINE__ ); \ |
58 | 59 | FLUSH_OUTPUT(); \ |
59 | 60 | rtems_test_exit( 1 ); \ |
60 | 61 | } \ |
-
RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm26/task1.c,v
retrieving revision 1.38
diff -u -r1.38 task1.c
|
|
|
453 | 453 | |
454 | 454 | _Thread_Heir = _Thread_Executing; |
455 | 455 | _Thread_Dispatch_necessary = false; |
456 | | _Thread_Dispatch_disable_level = 0; |
| 456 | |
| 457 | _Thread_Dispatch_set_disable_level( 0 ); |
457 | 458 | |
458 | 459 | /* |
459 | 460 | * Now dump all the times |
-
RCS file: /usr1/CVS/rtems/testsuites/tmtests/tm27/task1.c,v
retrieving revision 1.34
diff -u -r1.34 task1.c
|
|
|
111 | 111 | |
112 | 112 | Interrupt_nest = 0; |
113 | 113 | |
114 | | _Thread_Dispatch_disable_level = 0; |
| 114 | _Thread_Dispatch_set_disable_level( 0 ); |
115 | 115 | |
116 | 116 | Interrupt_occurred = 0; |
117 | 117 | |
… |
… |
|
144 | 144 | * No preempt .. nested |
145 | 145 | */ |
146 | 146 | |
147 | | _Thread_Dispatch_disable_level = 1; |
| 147 | _Thread_Dispatch_set_disable_level( 1 ); |
148 | 148 | |
149 | 149 | Interrupt_nest = 1; |
150 | 150 | |
… |
… |
|
158 | 158 | #endif |
159 | 159 | Interrupt_return_time = benchmark_timer_read(); |
160 | 160 | |
161 | | _Thread_Dispatch_disable_level = 0; |
| 161 | _Thread_Dispatch_set_disable_level( 0 ); |
162 | 162 | |
163 | 163 | put_time( |
164 | 164 | "interrupt entry overhead: returns to nested interrupt", |
… |
… |
|
180 | 180 | * Does a preempt .. not nested |
181 | 181 | */ |
182 | 182 | |
183 | | _Thread_Dispatch_disable_level = 0; |
| 183 | _Thread_Dispatch_set_disable_level( 0 ); |
184 | 184 | |
185 | 185 | ready_queues = (Chain_Control *) _Scheduler.information; |
186 | 186 | _Thread_Executing = |
… |
… |
|
241 | 241 | * Switch back to the other task to exit the test. |
242 | 242 | */ |
243 | 243 | |
244 | | _Thread_Dispatch_disable_level = 0; |
| 244 | _Thread_Dispatch_set_disable_level( 0 ); |
245 | 245 | |
246 | 246 | ready_queues = (Chain_Control *) _Scheduler.information; |
247 | 247 | _Thread_Executing = |
-
RCS file: /usr1/CVS/rtems/tools/schedsim/rtems/rtems_init.c,v
retrieving revision 1.1
diff -u -r1.1 rtems_init.c
|
|
|
101 | 101 | /* |
102 | 102 | * Now we are back in a non-dispatching critical section |
103 | 103 | */ |
104 | | _Thread_Dispatch_disable_level = 0; |
| 104 | _Thread_Dispatch_set_disable_level( 0 ); |
105 | 105 | |
106 | 106 | /* |
107 | 107 | * Print an initial message |