From 3291b2a7d558d2b4095cdb8abba84ff3ed0dc59b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 17 Sep 2021 08:49:56 +0200 Subject: score: Ensure only one CPU if required Issue the new fatal SMP error SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR if the system starts with not exactly one processor and an uniprocessor scheduler is configured. --- cpukit/score/src/schedulerdefaultpinunpindonothing.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cpukit/score/src/schedulerdefaultpinunpindonothing.c') diff --git a/cpukit/score/src/schedulerdefaultpinunpindonothing.c b/cpukit/score/src/schedulerdefaultpinunpindonothing.c index f7bab4f661..f3ecb0b718 100644 --- a/cpukit/score/src/schedulerdefaultpinunpindonothing.c +++ b/cpukit/score/src/schedulerdefaultpinunpindonothing.c @@ -39,6 +39,9 @@ #endif #include +#include +#include +#include void _Scheduler_default_Pin_or_unpin_do_nothing( const Scheduler_Control *scheduler, @@ -52,3 +55,19 @@ void _Scheduler_default_Pin_or_unpin_do_nothing( (void) node; (void) cpu; } + +static void _Scheduler_Ensure_exactly_one_processor( void ) +{ + if ( _SMP_Get_processor_maximum() != 1 ) { + _Terminate( + RTEMS_FATAL_SOURCE_SMP, + SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR + ); + } +} + +RTEMS_SYSINIT_ITEM( + _Scheduler_Ensure_exactly_one_processor, + RTEMS_SYSINIT_SCHEDULER, + RTEMS_SYSINIT_ORDER_MIDDLE +); -- cgit v1.2.3