diff options
-rw-r--r-- | cpukit/score/include/rtems/score/userextimpl.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/sysinit.h | 4 | ||||
-rw-r--r-- | cpukit/score/src/userextiterate.c | 33 | ||||
-rw-r--r-- | testsuites/sptests/spextensions01/init.c | 62 | ||||
-rw-r--r-- | testsuites/sptests/spsysinit01/init.c | 6 |
5 files changed, 58 insertions, 51 deletions
diff --git a/cpukit/score/include/rtems/score/userextimpl.h b/cpukit/score/include/rtems/score/userextimpl.h index 6684c4a264..5ad2c63765 100644 --- a/cpukit/score/include/rtems/score/userextimpl.h +++ b/cpukit/score/include/rtems/score/userextimpl.h @@ -307,7 +307,7 @@ static inline void _User_extensions_Fatal( _User_extensions_Iterate( &ctx, _User_extensions_Fatal_visitor, - CHAIN_ITERATOR_BACKWARD + CHAIN_ITERATOR_FORWARD ); } @@ -318,7 +318,7 @@ static inline void _User_extensions_Thread_terminate( _User_extensions_Iterate( executing, _User_extensions_Thread_terminate_visitor, - CHAIN_ITERATOR_FORWARD + CHAIN_ITERATOR_BACKWARD ); } diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h index 7923385cd1..bd4778ab5c 100644 --- a/cpukit/score/include/rtems/sysinit.h +++ b/cpukit/score/include/rtems/sysinit.h @@ -55,8 +55,8 @@ extern "C" { #define RTEMS_SYSINIT_POSIX_BARRIER 000367 #define RTEMS_SYSINIT_POSIX_RWLOCK 000368 #define RTEMS_SYSINIT_POSIX_SHM 000369 -#define RTEMS_SYSINIT_POSIX_CLEANUP 00036a -#define RTEMS_SYSINIT_POSIX_KEYS 00036b +#define RTEMS_SYSINIT_POSIX_KEYS 00036a +#define RTEMS_SYSINIT_POSIX_CLEANUP 00036b #define RTEMS_SYSINIT_IDLE_THREADS 000380 #define RTEMS_SYSINIT_LIBIO 000400 #define RTEMS_SYSINIT_ROOT_FILESYSTEM 000401 diff --git a/cpukit/score/src/userextiterate.c b/cpukit/score/src/userextiterate.c index 6e143765c2..04fe278639 100644 --- a/cpukit/score/src/userextiterate.c +++ b/cpukit/score/src/userextiterate.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2012, 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2012, 2017 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -154,8 +154,9 @@ void _User_extensions_Iterate( ) { Thread_Control *executing; - const User_extensions_Table *callouts_current; - const User_extensions_Table *callouts_end; + const User_extensions_Table *initial_current; + const User_extensions_Table *initial_begin; + const User_extensions_Table *initial_end; const Chain_Node *end; Chain_Node *node; User_extensions_Iterator iter; @@ -163,17 +164,18 @@ void _User_extensions_Iterate( executing = _Thread_Get_executing(); - callouts_current = rtems_configuration_get_user_extension_table(); - callouts_end = callouts_current - + rtems_configuration_get_number_of_initial_extensions(); + initial_begin = rtems_configuration_get_user_extension_table(); + initial_end = + initial_begin + rtems_configuration_get_number_of_initial_extensions(); - while ( callouts_current != callouts_end ) { - (*visitor)( executing, arg, callouts_current ); + if ( direction == CHAIN_ITERATOR_FORWARD ) { + initial_current = initial_begin; - ++callouts_current; - } + while ( initial_current != initial_end ) { + (*visitor)( executing, arg, initial_current ); + ++initial_current; + } - if ( direction == CHAIN_ITERATOR_FORWARD ) { end = _Chain_Immutable_tail( &_User_extensions_List.Active ); } else { end = _Chain_Immutable_head( &_User_extensions_List.Active ); @@ -213,4 +215,13 @@ void _User_extensions_Iterate( _Chain_Iterator_destroy( &iter.Iterator ); _User_extensions_Release( &lock_context ); + + if ( direction == CHAIN_ITERATOR_BACKWARD ) { + initial_current = initial_end; + + while ( initial_current != initial_begin ) { + --initial_current; + (*visitor)( executing, arg, initial_current ); + } + } } diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index ceb9f60527..e8d053eee7 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2016, 2017 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -80,12 +80,6 @@ static void assert_thread_dispatch_disabled_context(void) assert(!life_protected()); } -static void assert_static_order(int index) -{ - assert((counter % active_extensions) == index); - ++counter; -} - static void assert_forward_order(int index) { assert((counter % active_extensions) == index); @@ -94,49 +88,49 @@ static void assert_forward_order(int index) static void assert_reverse_order(int index) { - assert((counter % active_extensions) == (5 - index)); + assert((counter % active_extensions) == (active_extensions - 1 - index)); ++counter; } static bool zero_thread_create(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_allocator_protected_thread_context(); return true; } static void zero_thread_start(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_thread_dispatch_disabled_context(); } static void zero_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); assert_life_protected_thread_context(); } static void zero_thread_delete(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_reverse_order(0); assert_allocator_protected_thread_context(); } static void zero_thread_switch(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(0); + assert_forward_order(0); } static void zero_thread_begin(rtems_tcb *a) { - assert_static_order(0); + assert_forward_order(0); assert_normal_thread_context(); } static void zero_thread_exitted(rtems_tcb *a) { - assert_static_order(0); + assert_forward_order(0); assert_normal_thread_context(); } @@ -147,55 +141,55 @@ static void zero_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_static_order(0); + assert_forward_order(0); } } static void zero_thread_terminate(rtems_tcb *a) { - assert_static_order(0); + assert_reverse_order(0); assert_life_protected_thread_context(); } static bool one_thread_create(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_allocator_protected_thread_context(); return true; } static void one_thread_start(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_thread_dispatch_disabled_context(); } static void one_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); assert_life_protected_thread_context(); } static void one_thread_delete(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_reverse_order(1); assert_allocator_protected_thread_context(); } static void one_thread_switch(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(1); + assert_forward_order(1); } static void one_thread_begin(rtems_tcb *a) { - assert_static_order(1); + assert_forward_order(1); assert_normal_thread_context(); } static void one_thread_exitted(rtems_tcb *a) { - assert_static_order(1); + assert_forward_order(1); assert_normal_thread_context(); } @@ -206,13 +200,13 @@ static void one_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_static_order(1); + assert_forward_order(1); } } static void one_thread_terminate(rtems_tcb *a) { - assert_static_order(1); + assert_reverse_order(1); assert_life_protected_thread_context(); } @@ -231,7 +225,7 @@ static void two_thread_start(rtems_tcb *a, rtems_tcb *b) static void two_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(2); + assert_forward_order(2); assert_life_protected_thread_context(); } @@ -265,15 +259,13 @@ static void two_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_reverse_order(2); - assert(counter == 72); - TEST_END(); + assert_forward_order(2); } } static void two_thread_terminate(rtems_tcb *a) { - assert_forward_order(2); + assert_reverse_order(2); assert_life_protected_thread_context(); } @@ -292,7 +284,7 @@ static void three_thread_start(rtems_tcb *a, rtems_tcb *b) static void three_thread_restart(rtems_tcb *a, rtems_tcb *b) { - assert_static_order(3); + assert_forward_order(3); assert_life_protected_thread_context(); } @@ -326,13 +318,15 @@ static void three_fatal( ) { if (source == RTEMS_FATAL_SOURCE_EXIT) { - assert_reverse_order(3); + assert_forward_order(3); + assert(counter == 72); + TEST_END(); } } static void three_thread_terminate(rtems_tcb *a) { - assert_forward_order(3); + assert_reverse_order(3); assert_life_protected_thread_context(); } diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c index 15072c3d20..612ba145a2 100644 --- a/testsuites/sptests/spsysinit01/init.c +++ b/testsuites/sptests/spsysinit01/init.c @@ -120,11 +120,13 @@ typedef enum { POSIX_RWLOCK_POST, POSIX_SHM_PRE, POSIX_SHM_POST, - POSIX_CLEANUP_PRE, - POSIX_CLEANUP_POST, #endif /* RTEMS_POSIX_API */ POSIX_KEYS_PRE, POSIX_KEYS_POST, +#ifdef RTEMS_POSIX_API + POSIX_CLEANUP_PRE, + POSIX_CLEANUP_POST, +#endif /* RTEMS_POSIX_API */ IDLE_THREADS_PRE, IDLE_THREADS_POST, LIBIO_PRE, |