summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-03 15:03:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-04-04 11:01:18 +0200
commit24934e36e2513f972510d7c746103be1f766dc6a (patch)
tree66e3c8840cec6c1262f142e25ec545926140dbf9
parentscore: Add and use Scheduler_simple_Control (diff)
downloadrtems-24934e36e2513f972510d7c746103be1f766dc6a.tar.bz2
score: Add scheduler control to scheduler ops
Scheduler operations must be free of a global scheduler context to enable partitioned/clustered scheduling.
-rw-r--r--cpukit/posix/src/nanosleep.c2
-rw-r--r--cpukit/posix/src/pthreadcreate.c1
-rw-r--r--cpukit/posix/src/pthreadgetaffinitynp.c12
-rw-r--r--cpukit/posix/src/pthreadsetaffinitynp.c17
-rw-r--r--cpukit/posix/src/sched_yield.c5
-rw-r--r--cpukit/rtems/src/clocktick.c2
-rw-r--r--cpukit/rtems/src/ratemoncancel.c6
-rw-r--r--cpukit/rtems/src/ratemondelete.c6
-rw-r--r--cpukit/rtems/src/ratemonperiod.c12
-rw-r--r--cpukit/rtems/src/taskgetaffinity.c13
-rw-r--r--cpukit/rtems/src/tasksetaffinity.c12
-rw-r--r--cpukit/rtems/src/taskwakeafter.c2
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h112
-rw-r--r--cpukit/score/include/rtems/score/schedulercbs.h9
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h31
-rw-r--r--cpukit/score/include/rtems/score/scheduleredfimpl.h12
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h154
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h30
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h16
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityimpl.h20
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h36
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h27
-rw-r--r--cpukit/score/include/rtems/score/schedulersimpleimpl.h19
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h31
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h4
-rw-r--r--cpukit/score/src/coremutexseize.c5
-rw-r--r--cpukit/score/src/schedulercbsallocate.c5
-rw-r--r--cpukit/score/src/schedulercbsreleasejob.c1
-rw-r--r--cpukit/score/src/schedulercbsunblock.c12
-rw-r--r--cpukit/score/src/schedulerdefaultallocatefree.c12
-rw-r--r--cpukit/score/src/schedulerdefaultgetaffinity.c14
-rw-r--r--cpukit/score/src/schedulerdefaultreleasejob.c8
-rw-r--r--cpukit/score/src/schedulerdefaultsetaffinity.c10
-rw-r--r--cpukit/score/src/schedulerdefaultstartidle.c11
-rw-r--r--cpukit/score/src/schedulerdefaulttick.c11
-rw-r--r--cpukit/score/src/schedulerdefaultupdate.c6
-rw-r--r--cpukit/score/src/scheduleredf.c2
-rw-r--r--cpukit/score/src/scheduleredfallocate.c5
-rw-r--r--cpukit/score/src/scheduleredfblock.c6
-rw-r--r--cpukit/score/src/scheduleredfenqueue.c3
-rw-r--r--cpukit/score/src/scheduleredfenqueuefirst.c3
-rw-r--r--cpukit/score/src/scheduleredfextract.c5
-rw-r--r--cpukit/score/src/scheduleredffree.c5
-rw-r--r--cpukit/score/src/scheduleredfreleasejob.c3
-rw-r--r--cpukit/score/src/scheduleredfschedule.c7
-rw-r--r--cpukit/score/src/scheduleredfunblock.c4
-rw-r--r--cpukit/score/src/scheduleredfupdate.c5
-rw-r--r--cpukit/score/src/scheduleredfyield.c11
-rw-r--r--cpukit/score/src/schedulerpriorityaffinitysmp.c23
-rw-r--r--cpukit/score/src/schedulerpriorityallocate.c5
-rw-r--r--cpukit/score/src/schedulerpriorityblock.c10
-rw-r--r--cpukit/score/src/schedulerpriorityenqueue.c6
-rw-r--r--cpukit/score/src/schedulerpriorityenqueuefirst.c8
-rw-r--r--cpukit/score/src/schedulerpriorityextract.c7
-rw-r--r--cpukit/score/src/schedulerpriorityfree.c3
-rw-r--r--cpukit/score/src/schedulerpriorityprioritycompare.c4
-rw-r--r--cpukit/score/src/schedulerpriorityschedule.c7
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c94
-rw-r--r--cpukit/score/src/schedulerpriorityunblock.c8
-rw-r--r--cpukit/score/src/schedulerpriorityupdate.c9
-rw-r--r--cpukit/score/src/schedulerpriorityyield.c17
-rw-r--r--cpukit/score/src/schedulersimpleblock.c8
-rw-r--r--cpukit/score/src/schedulersimpleenqueue.c5
-rw-r--r--cpukit/score/src/schedulersimpleenqueuefirst.c5
-rw-r--r--cpukit/score/src/schedulersimpleextract.c3
-rw-r--r--cpukit/score/src/schedulersimplereadyqueueenqueue.c3
-rw-r--r--cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c3
-rw-r--r--cpukit/score/src/schedulersimpleschedule.c7
-rw-r--r--cpukit/score/src/schedulersimplesmp.c90
-rw-r--r--cpukit/score/src/schedulersimpleunblock.c3
-rw-r--r--cpukit/score/src/schedulersimpleyield.c9
-rw-r--r--cpukit/score/src/threadchangepriority.c13
-rw-r--r--cpukit/score/src/threadclearstate.c2
-rw-r--r--cpukit/score/src/threadinitialize.c2
-rw-r--r--cpukit/score/src/threadready.c2
-rw-r--r--cpukit/score/src/threadrestart.c23
-rw-r--r--cpukit/score/src/threadsetpriority.c2
-rw-r--r--cpukit/score/src/threadsetstate.c2
-rw-r--r--cpukit/score/src/threadsettransient.c2
-rw-r--r--cpukit/score/src/threadstart.c6
-rw-r--r--testsuites/tmtests/tm26/task1.c12
-rw-r--r--testsuites/tmtests/tm27/task1.c6
82 files changed, 768 insertions, 386 deletions
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 52fcc96d6e..ebaef33b26 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -65,7 +65,7 @@ int nanosleep(
if ( !ticks ) {
_Thread_Disable_dispatch();
executing = _Thread_Executing;
- _Scheduler_Yield( executing );
+ _Scheduler_Yield( _Scheduler_Get( executing ), executing );
_Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 8ae790480b..f85e1efcfd 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -194,6 +194,7 @@ int pthread_create(
#if defined(RTEMS_SMP) && __RTEMS_HAVE_SYS_CPUSET_H__
status = _Scheduler_Set_affinity(
+ _Scheduler_Get( the_thread ),
the_thread,
the_attr->affinitysetsize,
the_attr->affinityset
diff --git a/cpukit/posix/src/pthreadgetaffinitynp.c b/cpukit/posix/src/pthreadgetaffinitynp.c
index 497236f60f..41b8d30be2 100644
--- a/cpukit/posix/src/pthreadgetaffinitynp.c
+++ b/cpukit/posix/src/pthreadgetaffinitynp.c
@@ -47,12 +47,14 @@ int pthread_getaffinity_np(
switch ( location ) {
case OBJECTS_LOCAL:
- ok = _Scheduler_Get_affinity( the_thread, cpusetsize, cpuset );
+ ok = _Scheduler_Get_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
_Objects_Put( &the_thread->Object );
- if (!ok)
- return EINVAL;
- return 0;
- break;
+ return ok ? 0 : EINVAL;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/posix/src/pthreadsetaffinitynp.c b/cpukit/posix/src/pthreadsetaffinitynp.c
index d150b409a1..d9df75b8de 100644
--- a/cpukit/posix/src/pthreadsetaffinitynp.c
+++ b/cpukit/posix/src/pthreadsetaffinitynp.c
@@ -47,15 +47,18 @@ int pthread_setaffinity_np(
switch ( location ) {
case OBJECTS_LOCAL:
- api = the_thread->API_Extensions[ THREAD_API_POSIX ];
- ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset );
- if (ok)
+ ok = _Scheduler_Set_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
+ if ( ok ) {
+ api = the_thread->API_Extensions[ THREAD_API_POSIX ];
CPU_COPY( api->Attributes.affinityset, cpuset );
+ }
_Objects_Put( &the_thread->Object );
- if (!ok)
- return EINVAL;
- return 0;
- break;
+ return ok ? 0 : EINVAL;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/posix/src/sched_yield.c b/cpukit/posix/src/sched_yield.c
index 906d102a37..5293b199dc 100644
--- a/cpukit/posix/src/sched_yield.c
+++ b/cpukit/posix/src/sched_yield.c
@@ -26,8 +26,11 @@
int sched_yield( void )
{
+ Thread_Control *executing;
+
_Thread_Disable_dispatch();
- _Scheduler_Yield( _Thread_Executing );
+ executing = _Thread_Executing;
+ _Scheduler_Yield( _Scheduler_Get( executing ), executing );
_Thread_Enable_dispatch();
return 0;
}
diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c
index a026b44494..1abaa7f20e 100644
--- a/cpukit/rtems/src/clocktick.c
+++ b/cpukit/rtems/src/clocktick.c
@@ -34,7 +34,7 @@ rtems_status_code rtems_clock_tick( void )
_Watchdog_Tickle_ticks();
- _Scheduler_Tick();
+ _Scheduler_Tick( _Scheduler_Get( NULL ) );
#if defined( RTEMS_SMP )
_Thread_Enable_dispatch();
diff --git a/cpukit/rtems/src/ratemoncancel.c b/cpukit/rtems/src/ratemoncancel.c
index d9b5dee6ea..9f993f2cdf 100644
--- a/cpukit/rtems/src/ratemoncancel.c
+++ b/cpukit/rtems/src/ratemoncancel.c
@@ -40,7 +40,11 @@ rtems_status_code rtems_rate_monotonic_cancel(
}
(void) _Watchdog_Remove( &the_period->Timer );
the_period->state = RATE_MONOTONIC_INACTIVE;
- _Scheduler_Release_job(the_period->owner, 0);
+ _Scheduler_Release_job(
+ _Scheduler_Get( the_period->owner ),
+ the_period->owner,
+ 0
+ );
_Objects_Put( &the_period->Object );
return RTEMS_SUCCESSFUL;
diff --git a/cpukit/rtems/src/ratemondelete.c b/cpukit/rtems/src/ratemondelete.c
index 36480beab1..ee0b23682f 100644
--- a/cpukit/rtems/src/ratemondelete.c
+++ b/cpukit/rtems/src/ratemondelete.c
@@ -35,7 +35,11 @@ rtems_status_code rtems_rate_monotonic_delete(
switch ( location ) {
case OBJECTS_LOCAL:
- _Scheduler_Release_job(the_period->owner, 0);
+ _Scheduler_Release_job(
+ _Scheduler_Get( the_period->owner ),
+ the_period->owner,
+ 0
+ );
_Objects_Close( &_Rate_monotonic_Information, &the_period->Object );
(void) _Watchdog_Remove( &the_period->Timer );
the_period->state = RATE_MONOTONIC_INACTIVE;
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 4c39fc56ff..9d31813353 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -144,7 +144,11 @@ void _Rate_monotonic_Initiate_statistics(
}
#endif
- _Scheduler_Release_job(the_period->owner, the_period->next_length);
+ _Scheduler_Release_job(
+ _Scheduler_Get( the_period->owner ),
+ the_period->owner,
+ the_period->next_length
+ );
}
static void _Rate_monotonic_Update_statistics(
@@ -340,7 +344,11 @@ rtems_status_code rtems_rate_monotonic_period(
the_period->next_length = length;
_Watchdog_Insert_ticks( &the_period->Timer, length );
- _Scheduler_Release_job(the_period->owner, the_period->next_length);
+ _Scheduler_Release_job(
+ _Scheduler_Get( the_period->owner ),
+ the_period->owner,
+ the_period->next_length
+ );
_Objects_Put( &the_period->Object );
return RTEMS_TIMEOUT;
}
diff --git a/cpukit/rtems/src/taskgetaffinity.c b/cpukit/rtems/src/taskgetaffinity.c
index d9cc25e646..c389f1b991 100644
--- a/cpukit/rtems/src/taskgetaffinity.c
+++ b/cpukit/rtems/src/taskgetaffinity.c
@@ -34,7 +34,7 @@ rtems_status_code rtems_task_get_affinity(
{
Thread_Control *the_thread;
Objects_Locations location;
- rtems_status_code status = RTEMS_SUCCESSFUL;
+ bool ok;
if ( !cpuset )
return RTEMS_INVALID_ADDRESS;
@@ -44,11 +44,14 @@ rtems_status_code rtems_task_get_affinity(
switch ( location ) {
case OBJECTS_LOCAL:
- if ( ! _Scheduler_Get_affinity( the_thread, cpusetsize, cpuset )) {
- status = RTEMS_INVALID_NUMBER;
- }
+ ok = _Scheduler_Get_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
_Objects_Put( &the_thread->Object );
- return status;
+ return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/rtems/src/tasksetaffinity.c b/cpukit/rtems/src/tasksetaffinity.c
index 4d767410a9..6d8def7aca 100644
--- a/cpukit/rtems/src/tasksetaffinity.c
+++ b/cpukit/rtems/src/tasksetaffinity.c
@@ -42,12 +42,14 @@ rtems_status_code rtems_task_set_affinity(
switch ( location ) {
case OBJECTS_LOCAL:
- ok = _Scheduler_Set_affinity( the_thread, cpusetsize, cpuset );
+ ok = _Scheduler_Set_affinity(
+ _Scheduler_Get( the_thread ),
+ the_thread,
+ cpusetsize,
+ cpuset
+ );
_Objects_Put( &the_thread->Object );
- if (! ok) {
- return RTEMS_INVALID_NUMBER;
- }
- return RTEMS_SUCCESSFUL;
+ return ok ? RTEMS_SUCCESSFUL : RTEMS_INVALID_NUMBER;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
diff --git a/cpukit/rtems/src/taskwakeafter.c b/cpukit/rtems/src/taskwakeafter.c
index aaa5bf39c7..367b43acc6 100644
--- a/cpukit/rtems/src/taskwakeafter.c
+++ b/cpukit/rtems/src/taskwakeafter.c
@@ -37,7 +37,7 @@ rtems_status_code rtems_task_wake_after(
executing = _Thread_Executing;
if ( ticks == 0 ) {
- _Scheduler_Yield( executing );
+ _Scheduler_Yield( _Scheduler_Get( executing ), executing );
} else {
_Thread_Set_state( executing, STATES_DELAYING );
_Watchdog_Initialize(
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 1890caf491..b975fc4a3e 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -40,6 +40,8 @@ extern "C" {
*/
/**@{*/
+typedef struct Scheduler_Control Scheduler_Control;
+
/**
* function jump table that holds pointers to the functions that
* implement specific schedulers.
@@ -49,58 +51,65 @@ typedef struct {
void ( *initialize )(void);
/** Implements the scheduling decision logic (policy). */
- void ( *schedule )( Thread_Control *thread );
+ void ( *schedule )( Scheduler_Control *, Thread_Control *);
/**
* @brief Voluntarily yields the processor per the scheduling policy.
*
* @see _Scheduler_Yield().
*/
- void ( *yield )( Thread_Control *thread );
+ void ( *yield )( Scheduler_Control *, Thread_Control *);
/** Removes the given thread from scheduling decisions. */
- void ( *block )(Thread_Control *);
+ void ( *block )( Scheduler_Control *, Thread_Control * );
/** Adds the given thread to scheduling decisions. */
- void ( *unblock )(Thread_Control *);
+ void ( *unblock )( Scheduler_Control *, Thread_Control * );
/** allocates the scheduler field of the given thread */
- void * ( *allocate )(Thread_Control *);
+ void * ( *allocate )( Scheduler_Control *, Thread_Control * );
/** frees the scheduler field of the given thread */
- void ( *free )(Thread_Control *);
+ void ( *free )( Scheduler_Control *, Thread_Control * );
/** updates the scheduler field of the given thread -- primarily used
* when changing the thread's priority. */
- void ( *update )(Thread_Control *);
+ void ( *update )( Scheduler_Control *, Thread_Control * );
/** enqueue a thread as the last of its priority group */
- void ( *enqueue )(Thread_Control *);
+ void ( *enqueue )( Scheduler_Control *, Thread_Control * );
/** enqueue a thread as the first of its priority group */
- void ( *enqueue_first )(Thread_Control *);
+ void ( *enqueue_first )( Scheduler_Control *, Thread_Control * );
/** extract a thread from the ready set */
- void ( *extract )(Thread_Control *);
+ void ( *extract )( Scheduler_Control *, Thread_Control * );
/**
* Compares two priorities (returns >0 for higher priority, 0 for equal
* and <0 for lower priority).
*/
- int ( *priority_compare )(Priority_Control, Priority_Control);
+ int ( *priority_compare )(
+ Priority_Control,
+ Priority_Control
+ );
/** This routine is called upon release of a new job. */
- void ( *release_job ) (Thread_Control *, uint32_t);
+ void ( *release_job ) ( Scheduler_Control *, Thread_Control *, uint32_t );
/** perform scheduler update actions required at each clock tick */
- void ( *tick )(void);
+ void ( *tick )( Scheduler_Control * );
/**
* @brief Starts the idle thread for a particular processor.
*
* @see _Scheduler_Start_idle().
*/
- void ( *start_idle )( Thread_Control *thread, Per_CPU_Control *processor );
+ void ( *start_idle )(
+ Scheduler_Control *,
+ Thread_Control *,
+ Per_CPU_Control *
+ );
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
/**
@@ -108,7 +117,12 @@ typedef struct {
*
* @see _Scheduler_Get_affinity().
*/
- bool ( *get_affinity )( Thread_Control *thread, size_t cpusetsize, cpu_set_t *cpuset );
+ bool ( *get_affinity )(
+ Scheduler_Control *,
+ Thread_Control *,
+ size_t,
+ cpu_set_t *
+ );
/**
* @brief Set the processor affinity for a thread.
@@ -116,18 +130,18 @@ typedef struct {
* @see _Scheduler_Set_affinity().
*/
bool ( *set_affinity )(
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ Scheduler_Control *,
+ Thread_Control *,
+ size_t,
+ const cpu_set_t *
);
#endif
-
} Scheduler_Operations;
/**
* This is the structure used to manage the scheduler.
*/
-typedef struct {
+struct Scheduler_Control {
/**
* This points to the data structure used to manage the ready set of
* tasks. The pointer varies based upon the type of
@@ -137,7 +151,7 @@ typedef struct {
/** The jump table for scheduler-specific functions */
Scheduler_Operations Operations;
-} Scheduler_Control;
+};
/**
* The _Scheduler holds the structures used to manage the
@@ -152,41 +166,49 @@ extern Scheduler_Control _Scheduler;
/**
* @brief Returns an arbitrary non-NULL value.
*
- * @param[in] thread Unused.
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
*
* @return An arbitrary non-NULL value.
*/
void *_Scheduler_default_Allocate(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
* @brief Does nothing.
*
- * @param[in] thread Unused.
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
*/
void _Scheduler_default_Free(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
* @brief Does nothing.
*
- * @param[in] thread Unused.
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
*/
void _Scheduler_default_Update(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
* @brief Does nothing.
*
- * @param[in] thread Unused.
+ * @param[in] scheduler Unused.
+ * @param[in] the_thread Unused.
* @param[in] deadline Unused.
*/
void _Scheduler_default_Release_job(
- Thread_Control *thread,
- uint32_t deadline
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
);
/**
@@ -194,18 +216,22 @@ void _Scheduler_default_Release_job(
* each executing thread.
*
* This routine is invoked as part of processing each clock tick.
+ *
+ * @param[in] scheduler The scheduler.
*/
-void _Scheduler_default_Tick( void );
+void _Scheduler_default_Tick( Scheduler_Control *scheduler );
/**
- * @brief Unblocks the thread.
+ * @brief Starts an idle thread.
*
- * @param[in,out] thread An idle thread.
- * @param[in] processor This parameter is unused.
+ * @param[in] scheduler The scheduler.
+ * @param[in] the_thread An idle thread.
+ * @param[in] cpu This parameter is unused.
*/
void _Scheduler_default_Start_idle(
- Thread_Control *thread,
- Per_CPU_Control *processor
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
);
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
@@ -220,9 +246,10 @@ void _Scheduler_default_Start_idle(
* @retval -1 The cpusetsize is invalid for the system
*/
bool _Scheduler_default_Get_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
@@ -238,9 +265,10 @@ void _Scheduler_default_Start_idle(
* the cpuset.
*/
bool _Scheduler_default_Set_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
);
#endif
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index d4ed7efb74..f654225f58 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -148,6 +148,7 @@ extern Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
* @note This has to be asessed as missed deadline of the current job.
*/
void _Scheduler_CBS_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -164,8 +165,9 @@ void _Scheduler_CBS_Unblock(
*/
void _Scheduler_CBS_Release_job (
- Thread_Control *the_thread,
- uint32_t length
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t length
);
/**
@@ -336,7 +338,8 @@ void _Scheduler_CBS_Budget_callout(
* management memory for.
*/
void *_Scheduler_CBS_Allocate(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
#ifdef __cplusplus
}
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 2d5f537c59..16d46a4928 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -121,6 +121,7 @@ void _Scheduler_EDF_Initialize( void );
* @param[in] the_thread is the thread to be blocked.
*/
void _Scheduler_EDF_Block(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -131,7 +132,10 @@ void _Scheduler_EDF_Block(
* This kernel routine sets the heir thread to be the next ready thread
* in the rbtree ready queue.
*/
-void _Scheduler_EDF_Schedule( Thread_Control *thread );
+void _Scheduler_EDF_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Allocates EDF specific information of @a the_thread.
@@ -142,7 +146,8 @@ void _Scheduler_EDF_Schedule( Thread_Control *thread );
* management memory for.
*/
void *_Scheduler_EDF_Allocate(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -154,7 +159,8 @@ void *_Scheduler_EDF_Allocate(
* will be deallocated.
*/
void _Scheduler_EDF_Free(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -166,7 +172,8 @@ void _Scheduler_EDF_Free(
* structure updated.
*/
void _Scheduler_EDF_Update(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -179,6 +186,7 @@ void _Scheduler_EDF_Update(
* @param[in] the_thread will be unblocked.
*/
void _Scheduler_EDF_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -197,7 +205,10 @@ void _Scheduler_EDF_Unblock(
*
* @param[in,out] thread The yielding thread.
*/
-void _Scheduler_EDF_Yield( Thread_Control *thread );
+void _Scheduler_EDF_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Put @a the_thread to the rbtree ready queue.
@@ -207,6 +218,7 @@ void _Scheduler_EDF_Yield( Thread_Control *thread );
* @param[in] the_thread will be enqueued to the ready queue.
*/
void _Scheduler_EDF_Enqueue(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -219,6 +231,7 @@ void _Scheduler_EDF_Enqueue(
* @param[in] the_thread will be enqueued to the ready queue.
*/
void _Scheduler_EDF_Enqueue_first(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -232,7 +245,8 @@ void _Scheduler_EDF_Enqueue_first(
* @param[in] the_thread will be extracted from the ready set.
*/
void _Scheduler_EDF_Extract(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -261,8 +275,9 @@ int _Scheduler_EDF_Priority_compare (
* has to be suspended.
*/
void _Scheduler_EDF_Release_job (
- Thread_Control *the_thread,
- uint32_t deadline
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
);
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index aa1d21591f..bfeff639dd 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -31,24 +31,26 @@ extern "C" {
* @{
*/
-RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *_Scheduler_EDF_Instance( void )
+RTEMS_INLINE_ROUTINE Scheduler_EDF_Control *
+ _Scheduler_EDF_Self_from_base( Scheduler_Control *scheduler_base )
{
- return _Scheduler.information;
+ return (Scheduler_EDF_Control *) scheduler_base->information;
}
RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread,
bool force_dispatch
)
{
Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Instance();
+ _Scheduler_EDF_Self_from_base( scheduler_base );
RBTree_Node *first = _RBTree_First(&scheduler->Ready, RBT_LEFT);
Scheduler_EDF_Per_thread *sched_info =
_RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
Thread_Control *heir = (Thread_Control *) sched_info->thread;
- ( void ) thread;
+ ( void ) the_thread;
_Scheduler_Update_heir( heir, force_dispatch );
}
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 72f239fd6b..6687fcf2e4 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -61,11 +61,14 @@ void _Scheduler_Handler_initialization( void );
* This kernel routine implements the scheduling decision logic for
* the scheduler. It does NOT dispatch.
*
- * @param[in] thread The thread which state changed previously.
+ * @param[in] the_thread The thread which state changed previously.
*/
-RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *thread )
+RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
- _Scheduler.Operations.schedule( thread );
+ ( *scheduler->Operations.schedule )( scheduler, the_thread );
}
/**
@@ -74,13 +77,14 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *thread )
* This routine is invoked when a thread wishes to voluntarily transfer control
* of the processor to another thread.
*
- * @param[in] thread The yielding thread.
+ * @param[in] the_thread The yielding thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- ( *_Scheduler.Operations.yield )( thread );
+ ( *scheduler->Operations.yield )( scheduler, the_thread );
}
/**
@@ -92,10 +96,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
* including the selection of a new heir thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Block(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler.Operations.block( the_thread );
+ ( *scheduler->Operations.block )( scheduler, the_thread );
}
/**
@@ -107,10 +112,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Block(
* scheduling variables, for example the heir thread.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler.Operations.unblock( the_thread );
+ ( *scheduler->Operations.unblock )( scheduler, the_thread );
}
/**
@@ -119,10 +125,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
* This routine allocates @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- return _Scheduler.Operations.allocate( the_thread );
+ return ( *scheduler->Operations.allocate )( scheduler, the_thread );
}
/**
@@ -131,10 +138,11 @@ RTEMS_INLINE_ROUTINE void* _Scheduler_Allocate(
* This routine frees @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Free(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler.Operations.free( the_thread );
+ ( *scheduler->Operations.free )( scheduler, the_thread );
}
/**
@@ -143,10 +151,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Free(
* This routine updates @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Update(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler.Operations.update( the_thread );
+ ( *scheduler->Operations.update )( scheduler, the_thread );
}
/**
@@ -155,10 +164,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update(
* This routine enqueue @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler.Operations.enqueue( the_thread );
+ ( *scheduler->Operations.enqueue )( scheduler, the_thread );
}
/**
@@ -167,10 +177,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue(
* This routine enqueue_first @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler.Operations.enqueue_first( the_thread );
+ ( *scheduler->Operations.enqueue_first )( scheduler, the_thread );
}
/**
@@ -179,10 +190,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Enqueue_first(
* This routine extract @a the_thread->scheduler
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler.Operations.extract( the_thread );
+ ( *scheduler->Operations.extract )( scheduler, the_thread );
}
/**
@@ -191,11 +203,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
* This routine compares two priorities.
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
+ Scheduler_Control *scheduler,
Priority_Control p1,
Priority_Control p2
)
{
- return _Scheduler.Operations.priority_compare(p1, p2);
+ return ( *scheduler->Operations.priority_compare )( p1, p2 );
}
/**
@@ -204,11 +217,12 @@ RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
* This routine is called when a new period of task is issued.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
- Thread_Control *the_thread,
- uint32_t length
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t length
)
{
- _Scheduler.Operations.release_job(the_thread, length);
+ ( *scheduler->Operations.release_job )( scheduler, the_thread, length );
}
/**
@@ -219,25 +233,26 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
* scheduler which support standard RTEMS features, this includes
* time-slicing management.
*/
-RTEMS_INLINE_ROUTINE void _Scheduler_Tick( void )
+RTEMS_INLINE_ROUTINE void _Scheduler_Tick( Scheduler_Control *scheduler )
{
- _Scheduler.Operations.tick();
+ ( *scheduler->Operations.tick )( scheduler );
}
/**
* @brief Starts the idle thread for a particular processor.
*
- * @param[in,out] thread The idle thread for the processor.
+ * @param[in,out] the_thread The idle thread for the processor.
* @parma[in,out] processor The processor for the idle thread.
*
* @see _Thread_Create_idle().
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
- Thread_Control *thread,
- Per_CPU_Control *processor
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
)
{
- ( *_Scheduler.Operations.start_idle )( thread, processor );
+ ( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
}
#if defined(__RTEMS_HAVE_SYS_CPUSET_H__) && defined(RTEMS_SMP)
@@ -248,12 +263,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @parma[out] cpuset The processor affinity for this thread
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Get_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
- return (*_Scheduler.Operations.get_affinity)( thread, cpusetsize, cpuset );
+ return ( *scheduler->Operations.get_affinity )(
+ scheduler,
+ thread,
+ cpusetsize,
+ cpuset
+ );
}
/**
@@ -263,12 +284,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
* @parma[in] cpuset The processor affinity for this thread
*/
RTEMS_INLINE_ROUTINE int _Scheduler_Set_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
)
{
- return (*_Scheduler.Operations.set_affinity)( thread, cpusetsize, cpuset );
+ return ( *scheduler->Operations.set_affinity )(
+ scheduler,
+ thread,
+ cpusetsize,
+ cpuset
+ );
}
#endif
@@ -286,17 +313,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_heir(
}
RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
- void ( *extract )( Thread_Control *thread ),
- void ( *schedule )( Thread_Control *thread, bool force_dispatch ),
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ void ( *extract )( Scheduler_Control *, Thread_Control * ),
+ void ( *schedule )( Scheduler_Control *, Thread_Control *, bool )
)
{
- ( *extract )( thread );
+ ( *extract )( scheduler, the_thread );
/* TODO: flash critical section? */
- if ( _Thread_Is_executing( thread ) || _Thread_Is_heir( thread ) ) {
- ( *schedule )( thread, true );
+ if ( _Thread_Is_executing( the_thread ) || _Thread_Is_heir( the_thread ) ) {
+ ( *schedule )( scheduler, the_thread, true );
}
}
@@ -305,11 +333,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
* intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
- Priority_Control p1,
- Priority_Control p2
+ Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
- return _Scheduler_Priority_compare( p1, p2 ) < 0;
+ return _Scheduler_Priority_compare( scheduler, p1, p2 ) < 0;
}
/**
@@ -317,11 +346,12 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
* intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
- Priority_Control p1,
- Priority_Control p2
+ Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
- return _Scheduler_Priority_compare( p1, p2 ) > 0;
+ return _Scheduler_Priority_compare( scheduler, p1, p2 ) > 0;
}
/**
@@ -329,11 +359,12 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
* in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
- Priority_Control p1,
- Priority_Control p2
+ Scheduler_Control *scheduler,
+ Priority_Control p1,
+ Priority_Control p2
)
{
- return _Scheduler_Is_priority_higher_than( p1, p2 ) ? p1 : p2;
+ return _Scheduler_Is_priority_higher_than( scheduler, p1, p2 ) ? p1 : p2;
}
/**
@@ -341,13 +372,14 @@ RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Highest_priority_of_two(
* current priority of the thread in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
- Thread_Control *the_thread,
- Priority_Control priority
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Priority_Control priority
)
{
Priority_Control current = the_thread->current_priority;
- if ( _Scheduler_Is_priority_higher_than( priority, current ) ) {
+ if ( _Scheduler_Is_priority_higher_than( scheduler, priority, current ) ) {
_Thread_Set_priority( the_thread, priority );
}
}
@@ -357,18 +389,28 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Set_priority_if_higher(
* current priority of the thread in the intuitive sense of priority.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority_if_higher(
- Thread_Control *the_thread,
- Priority_Control priority,
- bool prepend_it
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Priority_Control priority,
+ bool prepend_it
)
{
Priority_Control current = the_thread->current_priority;
- if ( _Scheduler_Is_priority_higher_than( priority, current ) ) {
+ if ( _Scheduler_Is_priority_higher_than( scheduler, priority, current ) ) {
_Thread_Change_priority( the_thread, priority, prepend_it );
}
}
+RTEMS_INLINE_ROUTINE Scheduler_Control *_Scheduler_Get(
+ Thread_Control *the_thread
+)
+{
+ (void) the_thread;
+
+ return &_Scheduler;
+}
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 0bc455293c..1e4e91ba32 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -105,6 +105,7 @@ void _Scheduler_priority_Initialize(void);
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_priority_Block(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -114,7 +115,10 @@ void _Scheduler_priority_Block(
* This kernel routine sets the heir thread to be the next ready thread
* by invoking the_scheduler->ready_queue->operations->first().
*/
-void _Scheduler_priority_Schedule( Thread_Control *thread );
+void _Scheduler_priority_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Allocates @a the_thread->scheduler.
@@ -125,7 +129,8 @@ void _Scheduler_priority_Schedule( Thread_Control *thread );
* management memory for
*/
void * _Scheduler_priority_Allocate(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -137,7 +142,8 @@ void * _Scheduler_priority_Allocate(
* will be deallocated.
*/
void _Scheduler_priority_Free(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -149,7 +155,8 @@ void _Scheduler_priority_Free(
* structure updated.
*/
void _Scheduler_priority_Update(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -162,6 +169,7 @@ void _Scheduler_priority_Update(
* @param[in] the_thread will be unblocked
*/
void _Scheduler_priority_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -184,7 +192,10 @@ void _Scheduler_priority_Unblock(
*
* @param[in,out] thread The yielding thread.
*/
-void _Scheduler_priority_Yield( Thread_Control *thread );
+void _Scheduler_priority_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Puts @a the_thread on to the priority-based ready queue.
@@ -194,6 +205,7 @@ void _Scheduler_priority_Yield( Thread_Control *thread );
* @param[in] the_thread will be enqueued at the TAIL of its priority.
*/
void _Scheduler_priority_Enqueue(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -207,6 +219,7 @@ void _Scheduler_priority_Enqueue(
* @param[in] the_thread will be enqueued at the HEAD of its priority.
*/
void _Scheduler_priority_Enqueue_first(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -219,7 +232,8 @@ void _Scheduler_priority_Enqueue_first(
* @param[in] the_thread will be extracted from the ready set.
*/
void _Scheduler_priority_Extract(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -228,8 +242,8 @@ void _Scheduler_priority_Extract(
* This routine compares two priorities.
*/
int _Scheduler_priority_Priority_compare(
- Priority_Control p1,
- Priority_Control p2
+ Priority_Control p1,
+ Priority_Control p2
);
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index fe1978176f..8f9d0818b1 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -81,6 +81,7 @@ void * _Scheduler_priority_affinity_SMP_Allocate( Thread_Control *the_thread );
/**
* @brief Get affinity for the priority affinity smp scheduler.
*
+ * @param[in] scheduler The scheduler of the thread.
* @param[in] thread The associated thread.
* @param[in] cpusetsize The size of the cpuset.
* @param[in,out] cpuset The associated affinity set.
@@ -89,14 +90,16 @@ void * _Scheduler_priority_affinity_SMP_Allocate( Thread_Control *the_thread );
* @retval -1 The cpusetsize is invalid for the system
*/
bool _Scheduler_priority_affinity_SMP_Get_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
* @brief Set affinity for the priority affinity smp scheduler.
*
+ * @param[in] scheduler The scheduler of the thread.
* @param[in] thread The associated thread.
* @param[in] cpusetsize The size of the cpuset.
* @param[in] cpuset Affinity new affinity set.
@@ -104,9 +107,10 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
* @retval 0 Successful
*/
bool _Scheduler_priority_affinity_SMP_Set_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
);
/**
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index ebcc3f1762..7861df5c90 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -36,9 +36,9 @@ extern "C" {
/**@{**/
RTEMS_INLINE_ROUTINE Scheduler_priority_Control *
- _Scheduler_priority_Instance( void )
+ _Scheduler_priority_Self_from_base( Scheduler_Control *scheduler_base )
{
- return _Scheduler.information;
+ return (Scheduler_priority_Control *) scheduler_base->information;
}
/**
@@ -134,10 +134,12 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
}
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Extract_body(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( scheduler_base );
_Scheduler_priority_Ready_queue_extract( the_thread, &scheduler->Bit_map );
}
@@ -191,17 +193,19 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue(
* for priority-based scheduling.
*/
RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(
- Thread_Control *thread,
- bool force_dispatch
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread,
+ bool force_dispatch
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( scheduler_base );
Thread_Control *heir = _Scheduler_priority_Ready_queue_first(
&scheduler->Bit_map,
&scheduler->Ready[ 0 ]
);
- ( void ) thread;
+ ( void ) the_thread;
_Scheduler_Update_heir( heir, force_dispatch );
}
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 409d9febfa..905549d125 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -73,21 +73,43 @@ extern "C" {
void _Scheduler_priority_SMP_Initialize( void );
-void _Scheduler_priority_SMP_Schedule( Thread_Control *thread );
+void _Scheduler_priority_SMP_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Block( Thread_Control *thread );
+void _Scheduler_priority_SMP_Block(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Update( Thread_Control *thread );
+void _Scheduler_priority_SMP_Update(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Enqueue_fifo( Thread_Control *thread );
+void _Scheduler_priority_SMP_Enqueue_fifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Enqueue_lifo( Thread_Control *thread );
+void _Scheduler_priority_SMP_Enqueue_lifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Extract( Thread_Control *thread );
+void _Scheduler_priority_SMP_Extract(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_priority_SMP_Yield( Thread_Control *thread );
+void _Scheduler_priority_SMP_Yield(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
void _Scheduler_priority_SMP_Start_idle(
+ Scheduler_Control *base,
Thread_Control *thread,
Per_CPU_Control *cpu
);
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 54b0801872..889c5a79c6 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -76,7 +76,10 @@ void _Scheduler_simple_Initialize( void );
* on the ready queue by getting the first node in the scheduler
* information.
*/
-void _Scheduler_simple_Schedule( Thread_Control *thread );
+void _Scheduler_simple_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Invoked when a thread wishes to voluntarily
@@ -94,7 +97,10 @@ void _Scheduler_simple_Schedule( Thread_Control *thread );
*
* @param[in,out] thread The yielding thread.
*/
-void _Scheduler_simple_Yield( Thread_Control *thread );
+void _Scheduler_simple_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+);
/**
* @brief Remove a simple-priority-based thread from the queue.
@@ -107,7 +113,8 @@ void _Scheduler_simple_Yield( Thread_Control *thread );
* @param[in] the_thread is the thread that is to be blocked
*/
void _Scheduler_simple_Block(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -120,7 +127,8 @@ void _Scheduler_simple_Block(
* @param[in] the_thread is the thread that is to be unblocked
*/
void _Scheduler_simple_Unblock(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -132,7 +140,8 @@ void _Scheduler_simple_Unblock(
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_simple_Extract(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -143,7 +152,8 @@ void _Scheduler_simple_Extract(
* @param[in] the_thread is the thread to be enqueued
*/
void _Scheduler_simple_Enqueue(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -156,7 +166,8 @@ void _Scheduler_simple_Enqueue(
* @param[in] the_thread is the thread to be blocked
*/
void _Scheduler_simple_Enqueue_first(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
);
/**
@@ -168,6 +179,7 @@ void _Scheduler_simple_Enqueue_first(
* @param[in] the_thread - pointer to a thread control block
*/
void _Scheduler_simple_Ready_queue_enqueue(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
@@ -181,6 +193,7 @@ void _Scheduler_simple_Ready_queue_enqueue(
* @param[in] the_thread - pointer to a thread control block
*/
void _Scheduler_simple_Ready_queue_enqueue_first(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
);
diff --git a/cpukit/score/include/rtems/score/schedulersimpleimpl.h b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
index c51c6c3f0e..8ad142f0b4 100644
--- a/cpukit/score/include/rtems/score/schedulersimpleimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersimpleimpl.h
@@ -32,9 +32,10 @@ extern "C" {
*/
/**@{**/
-RTEMS_INLINE_ROUTINE Scheduler_simple_Control *_Scheduler_simple_Instance( void )
+RTEMS_INLINE_ROUTINE Scheduler_simple_Control *
+ _Scheduler_simple_Self_from_base( Scheduler_Control *scheduler_base )
{
- return _Scheduler.information;
+ return (Scheduler_simple_Control *) scheduler_base->information;
}
/**
@@ -44,7 +45,7 @@ RTEMS_INLINE_ROUTINE Scheduler_simple_Control *_Scheduler_simple_Instance( void
* @param[in] the_thread is the thread to be blocked
*/
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
- Scheduler_Control *the_ready_queue,
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
@@ -52,7 +53,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Ready_queue_requeue(
_Chain_Extract_unprotected( &the_thread->Object.Node );
/* enqueue */
- _Scheduler_simple_Ready_queue_enqueue( the_thread );
+ _Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
}
RTEMS_INLINE_ROUTINE bool _Scheduler_simple_Insert_priority_lifo_order(
@@ -102,14 +103,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_simple_Insert_priority_fifo(
}
RTEMS_INLINE_ROUTINE void _Scheduler_simple_Schedule_body(
- Thread_Control *thread,
- bool force_dispatch
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread,
+ bool force_dispatch
)
{
- Scheduler_simple_Control *scheduler = _Scheduler_simple_Instance();
+ Scheduler_simple_Control *scheduler =
+ _Scheduler_simple_Self_from_base( scheduler_base );
Thread_Control *heir = (Thread_Control *) _Chain_First( &scheduler->Ready );
- ( void ) thread;
+ ( void ) the_thread;
_Scheduler_Update_heir( heir, force_dispatch );
}
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 000a975c93..a6d826208d 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -75,19 +75,38 @@ extern "C" {
void _Scheduler_simple_smp_Initialize( void );
-void _Scheduler_simple_smp_Block( Thread_Control *thread );
+void _Scheduler_simple_smp_Block(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread );
+void _Scheduler_simple_smp_Enqueue_priority_fifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_simple_smp_Enqueue_priority_lifo( Thread_Control *thread );
+void _Scheduler_simple_smp_Enqueue_priority_lifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_simple_smp_Extract( Thread_Control *thread );
+void _Scheduler_simple_smp_Extract(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_simple_smp_Yield( Thread_Control *thread );
+void _Scheduler_simple_smp_Yield(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
-void _Scheduler_simple_smp_Schedule( Thread_Control *thread );
+void _Scheduler_simple_smp_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *thread
+);
void _Scheduler_simple_smp_Start_idle(
+ Scheduler_Control *base,
Thread_Control *thread,
Per_CPU_Control *cpu
);
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index 2ac8344577..6d4ca9f898 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -176,7 +176,7 @@ bool _Thread_Initialize(
* @param entry_point
* @param pointer_argument
* @param numeric_argument
- * @param[in,out] processor The processor if used to start an idle thread
+ * @param[in,out] cpu The processor if used to start an idle thread
* during system initialization. Must be set to @c NULL to start a normal
* thread.
*/
@@ -186,7 +186,7 @@ bool _Thread_Start(
void *entry_point,
void *pointer_argument,
Thread_Entry_numeric_type numeric_argument,
- Per_CPU_Control *processor
+ Per_CPU_Control *cpu
);
bool _Thread_Restart(
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index fe6ee5e598..2f9c8da523 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -53,8 +53,11 @@ void _CORE_mutex_Seize_interrupt_blocking(
{
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
+ Thread_Control *holder = the_mutex->holder;
+
_Scheduler_Change_priority_if_higher(
- the_mutex->holder,
+ _Scheduler_Get( holder ),
+ holder,
executing->current_priority,
false
);
diff --git a/cpukit/score/src/schedulercbsallocate.c b/cpukit/score/src/schedulercbsallocate.c
index a1ac5771ff..908ea90933 100644
--- a/cpukit/score/src/schedulercbsallocate.c
+++ b/cpukit/score/src/schedulercbsallocate.c
@@ -26,12 +26,15 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_CBS_Allocate(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
void *sched;
Scheduler_CBS_Per_thread *schinfo;
+ (void) scheduler;
+
sched = _Workspace_Allocate(sizeof(Scheduler_CBS_Per_thread));
if ( sched ) {
the_thread->scheduler_info = sched;
diff --git a/cpukit/score/src/schedulercbsreleasejob.c b/cpukit/score/src/schedulercbsreleasejob.c
index a73dbb5c44..f4fc1a817c 100644
--- a/cpukit/score/src/schedulercbsreleasejob.c
+++ b/cpukit/score/src/schedulercbsreleasejob.c
@@ -24,6 +24,7 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_CBS_Release_job(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread,
uint32_t deadline
)
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 54030e4eee..11465f2ba2 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -25,6 +25,7 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_CBS_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
@@ -32,7 +33,7 @@ void _Scheduler_CBS_Unblock(
Scheduler_CBS_Server *serv_info;
Priority_Control new_priority;
- _Scheduler_EDF_Enqueue(the_thread);
+ _Scheduler_EDF_Enqueue( scheduler, the_thread );
/* TODO: flash critical section? */
sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
@@ -73,8 +74,13 @@ void _Scheduler_CBS_Unblock(
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( _Scheduler_Is_priority_higher_than( the_thread->current_priority,
- _Thread_Heir->current_priority)) {
+ if (
+ _Scheduler_Is_priority_higher_than(
+ scheduler,
+ the_thread->current_priority,
+ _Thread_Heir->current_priority
+ )
+ ) {
_Thread_Heir = the_thread;
if ( _Thread_Executing->is_preemptible ||
the_thread->current_priority == 0 )
diff --git a/cpukit/score/src/schedulerdefaultallocatefree.c b/cpukit/score/src/schedulerdefaultallocatefree.c
index a3be5a32e8..7ffade29e5 100644
--- a/cpukit/score/src/schedulerdefaultallocatefree.c
+++ b/cpukit/score/src/schedulerdefaultallocatefree.c
@@ -22,17 +22,21 @@
#include <rtems/score/scheduler.h>
void *_Scheduler_default_Allocate(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- ( void ) thread;
+ ( void ) scheduler;
+ ( void ) the_thread;
return ( void * )-1; /* maybe pick an appropriate poison value */
}
void _Scheduler_default_Free(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- ( void ) thread;
+ ( void ) scheduler;
+ ( void ) the_thread;
}
diff --git a/cpukit/score/src/schedulerdefaultgetaffinity.c b/cpukit/score/src/schedulerdefaultgetaffinity.c
index 44305d549f..b4a1d1aa9a 100644
--- a/cpukit/score/src/schedulerdefaultgetaffinity.c
+++ b/cpukit/score/src/schedulerdefaultgetaffinity.c
@@ -23,19 +23,23 @@
#include <rtems/score/cpusetimpl.h>
bool _Scheduler_default_Get_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
const CPU_set_Control *ctl;
+ (void) scheduler;
+ (void) thread;
+
ctl = _CPU_set_Default();
if ( cpusetsize != ctl->setsize ) {
return false;
}
CPU_COPY( cpuset, ctl->set );
-
- return true;
+
+ return true;
}
diff --git a/cpukit/score/src/schedulerdefaultreleasejob.c b/cpukit/score/src/schedulerdefaultreleasejob.c
index e029aac99b..10ebf84874 100644
--- a/cpukit/score/src/schedulerdefaultreleasejob.c
+++ b/cpukit/score/src/schedulerdefaultreleasejob.c
@@ -22,10 +22,12 @@
#include <rtems/score/scheduler.h>
void _Scheduler_default_Release_job(
- Thread_Control *thread,
- uint32_t deadline
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ uint32_t deadline
)
{
- ( void ) thread;
+ ( void ) scheduler;
+ ( void ) the_thread;
( void ) deadline;
}
diff --git a/cpukit/score/src/schedulerdefaultsetaffinity.c b/cpukit/score/src/schedulerdefaultsetaffinity.c
index ac731f0517..1115f3a0db 100644
--- a/cpukit/score/src/schedulerdefaultsetaffinity.c
+++ b/cpukit/score/src/schedulerdefaultsetaffinity.c
@@ -23,10 +23,14 @@
#include <rtems/score/cpusetimpl.h>
bool _Scheduler_default_Set_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ const cpu_set_t *cpuset
)
{
+ (void) scheduler;
+ (void) thread;
+
return _CPU_set_Is_valid( cpuset, cpusetsize );
}
diff --git a/cpukit/score/src/schedulerdefaultstartidle.c b/cpukit/score/src/schedulerdefaultstartidle.c
index 09fab2638b..caddb7f2a2 100644
--- a/cpukit/score/src/schedulerdefaultstartidle.c
+++ b/cpukit/score/src/schedulerdefaultstartidle.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 embedded brains GmbH
+ * Copyright (c) 2013-2014 embedded brains GmbH
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -13,10 +13,11 @@
#include <rtems/score/schedulerimpl.h>
void _Scheduler_default_Start_idle(
- Thread_Control *thread,
- Per_CPU_Control *processor
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread,
+ Per_CPU_Control *cpu
)
{
- (void) processor;
- _Scheduler_Unblock( thread );
+ (void) cpu;
+ _Scheduler_Unblock( scheduler, the_thread );
}
diff --git a/cpukit/score/src/schedulerdefaulttick.c b/cpukit/score/src/schedulerdefaulttick.c
index 5d9daa1ce1..1976a7490c 100644
--- a/cpukit/score/src/schedulerdefaulttick.c
+++ b/cpukit/score/src/schedulerdefaulttick.c
@@ -23,7 +23,10 @@
#include <rtems/score/threadimpl.h>
#include <rtems/score/smp.h>
-static void _Scheduler_default_Tick_for_executing( Thread_Control *executing )
+static void _Scheduler_default_Tick_for_executing(
+ Scheduler_Control *scheduler,
+ Thread_Control *executing
+)
{
#ifdef __RTEMS_USE_TICKS_FOR_STATISTICS__
/*
@@ -65,7 +68,7 @@ static void _Scheduler_default_Tick_for_executing( Thread_Control *executing )
* currently executing thread is placed at the rear of the
* FIFO for this priority and a new heir is selected.
*/
- _Scheduler_Yield( executing );
+ _Scheduler_Yield( scheduler, executing );
executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
}
break;
@@ -79,7 +82,7 @@ static void _Scheduler_default_Tick_for_executing( Thread_Control *executing )
}
}
-void _Scheduler_default_Tick( void )
+void _Scheduler_default_Tick( Scheduler_Control *scheduler )
{
uint32_t processor_count = _SMP_Get_processor_count();
uint32_t processor;
@@ -87,6 +90,6 @@ void _Scheduler_default_Tick( void )
for ( processor = 0 ; processor < processor_count ; ++processor ) {
const Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( processor );
- _Scheduler_default_Tick_for_executing( per_cpu->executing );
+ _Scheduler_default_Tick_for_executing( scheduler, per_cpu->executing );
}
}
diff --git a/cpukit/score/src/schedulerdefaultupdate.c b/cpukit/score/src/schedulerdefaultupdate.c
index 44f0c0809d..c1b62b27d5 100644
--- a/cpukit/score/src/schedulerdefaultupdate.c
+++ b/cpukit/score/src/schedulerdefaultupdate.c
@@ -22,8 +22,10 @@
#include <rtems/score/scheduler.h>
void _Scheduler_default_Update(
- Thread_Control *thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- ( void ) thread;
+ ( void ) scheduler;
+ ( void ) the_thread;
}
diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
index 14f784f99d..502a2a1d4a 100644
--- a/cpukit/score/src/scheduleredf.c
+++ b/cpukit/score/src/scheduleredf.c
@@ -38,7 +38,7 @@ static int _Scheduler_EDF_RBTree_compare_function
* This function compares only numbers for the red-black tree,
* but priorities have an opposite sense.
*/
- return (-1)*_Scheduler_Priority_compare(value1, value2);
+ return (-1)*_Scheduler_EDF_Priority_compare(value1, value2);
}
void _Scheduler_EDF_Initialize(void)
diff --git a/cpukit/score/src/scheduleredfallocate.c b/cpukit/score/src/scheduleredfallocate.c
index 6057266ad9..73df5b88e2 100644
--- a/cpukit/score/src/scheduleredfallocate.c
+++ b/cpukit/score/src/scheduleredfallocate.c
@@ -25,12 +25,15 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_EDF_Allocate(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
void *sched;
Scheduler_EDF_Per_thread *schinfo;
+ (void) scheduler;
+
sched = _Workspace_Allocate( sizeof(Scheduler_EDF_Per_thread) );
if ( sched ) {
diff --git a/cpukit/score/src/scheduleredfblock.c b/cpukit/score/src/scheduleredfblock.c
index b1eb081385..9ea5fc9a3f 100644
--- a/cpukit/score/src/scheduleredfblock.c
+++ b/cpukit/score/src/scheduleredfblock.c
@@ -22,12 +22,14 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Block(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
_Scheduler_Generic_block(
+ scheduler,
+ the_thread,
_Scheduler_EDF_Extract,
- _Scheduler_EDF_Schedule_body,
- the_thread
+ _Scheduler_EDF_Schedule_body
);
}
diff --git a/cpukit/score/src/scheduleredfenqueue.c b/cpukit/score/src/scheduleredfenqueue.c
index e7c2e44b62..2e7365b117 100644
--- a/cpukit/score/src/scheduleredfenqueue.c
+++ b/cpukit/score/src/scheduleredfenqueue.c
@@ -21,11 +21,12 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Enqueue(
+ Scheduler_Control *scheduler_base,
Thread_Control *the_thread
)
{
Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Instance();
+ _Scheduler_EDF_Self_from_base( scheduler_base );
Scheduler_EDF_Per_thread *sched_info =
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
diff --git a/cpukit/score/src/scheduleredfenqueuefirst.c b/cpukit/score/src/scheduleredfenqueuefirst.c
index b3ff0bb641..bcf70b4752 100644
--- a/cpukit/score/src/scheduleredfenqueuefirst.c
+++ b/cpukit/score/src/scheduleredfenqueuefirst.c
@@ -24,8 +24,9 @@
#include <rtems/score/scheduleredf.h>
void _Scheduler_EDF_Enqueue_first(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler_EDF_Enqueue(the_thread);
+ _Scheduler_EDF_Enqueue( scheduler, the_thread );
}
diff --git a/cpukit/score/src/scheduleredfextract.c b/cpukit/score/src/scheduleredfextract.c
index 0287b4ec86..ec634e0dfa 100644
--- a/cpukit/score/src/scheduleredfextract.c
+++ b/cpukit/score/src/scheduleredfextract.c
@@ -21,11 +21,12 @@
#include <rtems/score/scheduleredfimpl.h>
void _Scheduler_EDF_Extract(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread
)
{
Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Instance();
+ _Scheduler_EDF_Self_from_base( scheduler_base );
Scheduler_EDF_Per_thread *sched_info =
(Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
RBTree_Node *node = &(sched_info->Node);
diff --git a/cpukit/score/src/scheduleredffree.c b/cpukit/score/src/scheduleredffree.c
index 6dc2ec3872..d9493cc5ac 100644
--- a/cpukit/score/src/scheduleredffree.c
+++ b/cpukit/score/src/scheduleredffree.c
@@ -26,8 +26,11 @@
#include <rtems/score/wkspace.h>
void _Scheduler_EDF_Free(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
+ (void) scheduler;
+
_Workspace_Free( the_thread->scheduler_info );
}
diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
index f1b7d0712f..37ff2d5c06 100644
--- a/cpukit/score/src/scheduleredfreleasejob.c
+++ b/cpukit/score/src/scheduleredfreleasejob.c
@@ -23,12 +23,15 @@
#include <rtems/score/watchdogimpl.h>
void _Scheduler_EDF_Release_job(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread,
uint32_t deadline
)
{
Priority_Control new_priority;
+ (void) scheduler;
+
if (deadline) {
/* Initializing or shifting deadline. */
new_priority = (_Watchdog_Ticks_since_boot + deadline)
diff --git a/cpukit/score/src/scheduleredfschedule.c b/cpukit/score/src/scheduleredfschedule.c
index 42ad044135..f7acde3872 100644
--- a/cpukit/score/src/scheduleredfschedule.c
+++ b/cpukit/score/src/scheduleredfschedule.c
@@ -20,7 +20,10 @@
#include <rtems/score/scheduleredfimpl.h>
-void _Scheduler_EDF_Schedule( Thread_Control *thread )
+void _Scheduler_EDF_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
- _Scheduler_EDF_Schedule_body( thread, false );
+ _Scheduler_EDF_Schedule_body( scheduler, the_thread, false );
}
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 5c2caf87e3..0640e8c172 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -23,10 +23,11 @@
#include <rtems/score/thread.h>
void _Scheduler_EDF_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler_EDF_Enqueue(the_thread);
+ _Scheduler_EDF_Enqueue( scheduler, the_thread);
/* TODO: flash critical section? */
/*
@@ -42,6 +43,7 @@ void _Scheduler_EDF_Unblock(
* a pseudo-ISR system task, we need to do a context switch.
*/
if ( _Scheduler_Is_priority_lower_than(
+ scheduler,
_Thread_Heir->current_priority,
the_thread->current_priority )) {
_Thread_Heir = the_thread;
diff --git a/cpukit/score/src/scheduleredfupdate.c b/cpukit/score/src/scheduleredfupdate.c
index 79e3277f24..3069068cee 100644
--- a/cpukit/score/src/scheduleredfupdate.c
+++ b/cpukit/score/src/scheduleredfupdate.c
@@ -26,12 +26,15 @@
#include <rtems/score/thread.h>
void _Scheduler_EDF_Update(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_EDF_Per_thread *sched_info =
(Scheduler_EDF_Per_thread*)the_thread->scheduler_info;
+ (void) scheduler;
+
if (sched_info->queue_state == SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN) {
/* Shifts the priority to the region of background tasks. */
the_thread->Start.initial_priority |= (SCHEDULER_EDF_PRIO_MSB);
diff --git a/cpukit/score/src/scheduleredfyield.c b/cpukit/score/src/scheduleredfyield.c
index c9856842f5..5b14cade4b 100644
--- a/cpukit/score/src/scheduleredfyield.c
+++ b/cpukit/score/src/scheduleredfyield.c
@@ -21,14 +21,17 @@
#include <rtems/score/scheduleredfimpl.h>
-void _Scheduler_EDF_Yield( Thread_Control *thread )
+void _Scheduler_EDF_Yield(
+ Scheduler_Control *scheduler_base,
+ Thread_Control *the_thread
+)
{
Scheduler_EDF_Control *scheduler =
- _Scheduler_EDF_Instance();
+ _Scheduler_EDF_Self_from_base( scheduler_base );
ISR_Level level;
Scheduler_EDF_Per_thread *thread_info =
- (Scheduler_EDF_Per_thread *) thread->scheduler_info;
+ (Scheduler_EDF_Per_thread *) the_thread->scheduler_info;
RBTree_Node *thread_node = &(thread_info->Node);
_ISR_Disable( level );
@@ -42,7 +45,7 @@ void _Scheduler_EDF_Yield( Thread_Control *thread )
_ISR_Flash( level );
- _Scheduler_EDF_Schedule_body( thread, false );
+ _Scheduler_EDF_Schedule_body( scheduler_base, the_thread, false );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c
index 6d7dd3b7d9..08b6e825d3 100644
--- a/cpukit/score/src/schedulerpriorityaffinitysmp.c
+++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c
@@ -31,7 +31,10 @@ _Scheduler_priority_affinity_Get_scheduler_info( Thread_Control *thread )
return ( Scheduler_priority_affinity_SMP_Per_thread * ) thread->scheduler_info;
}
-void * _Scheduler_priority_affinity_SMP_Allocate( Thread_Control *the_thread )
+void * _Scheduler_priority_affinity_SMP_Allocate(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
_Workspace_Allocate( sizeof( *info ) );
@@ -45,14 +48,17 @@ void * _Scheduler_priority_affinity_SMP_Allocate( Thread_Control *the_thread )
}
bool _Scheduler_priority_affinity_SMP_Get_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
_Scheduler_priority_affinity_Get_scheduler_info(thread);
+ (void) scheduler;
+
if ( info->Affinity.setsize != cpusetsize ) {
return false;
}
@@ -62,13 +68,16 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
}
bool _Scheduler_priority_affinity_SMP_Set_affinity(
- Thread_Control *thread,
- size_t cpusetsize,
- cpu_set_t *cpuset
+ Scheduler_Control *scheduler,
+ Thread_Control *thread,
+ size_t cpusetsize,
+ cpu_set_t *cpuset
)
{
Scheduler_priority_affinity_SMP_Per_thread *info =
_Scheduler_priority_affinity_Get_scheduler_info(thread);
+
+ (void) scheduler;
if ( ! _CPU_set_Is_valid( cpuset, cpusetsize ) ) {
return false;
diff --git a/cpukit/score/src/schedulerpriorityallocate.c b/cpukit/score/src/schedulerpriorityallocate.c
index bbf08597c5..2225d3ddfc 100644
--- a/cpukit/score/src/schedulerpriorityallocate.c
+++ b/cpukit/score/src/schedulerpriorityallocate.c
@@ -23,12 +23,15 @@
#include <rtems/score/wkspace.h>
void *_Scheduler_priority_Allocate (
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
Scheduler_priority_Per_thread *sched_info_of_thread =
_Workspace_Allocate( sizeof( *sched_info_of_thread ) );
+ (void) scheduler;
+
the_thread->scheduler_info = sched_info_of_thread;
return sched_info_of_thread;
diff --git a/cpukit/score/src/schedulerpriorityblock.c b/cpukit/score/src/schedulerpriorityblock.c
index 259d6f00e8..02d73873ab 100644
--- a/cpukit/score/src/schedulerpriorityblock.c
+++ b/cpukit/score/src/schedulerpriorityblock.c
@@ -22,11 +22,15 @@
#include <rtems/score/schedulerpriorityimpl.h>
-void _Scheduler_priority_Block( Thread_Control *the_thread )
+void _Scheduler_priority_Block(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
_Scheduler_Generic_block(
+ scheduler,
+ the_thread,
_Scheduler_priority_Extract_body,
- _Scheduler_priority_Schedule_body,
- the_thread
+ _Scheduler_priority_Schedule_body
);
}
diff --git a/cpukit/score/src/schedulerpriorityenqueue.c b/cpukit/score/src/schedulerpriorityenqueue.c
index 54375cde2d..9d62c2ccee 100644
--- a/cpukit/score/src/schedulerpriorityenqueue.c
+++ b/cpukit/score/src/schedulerpriorityenqueue.c
@@ -21,10 +21,12 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Enqueue(
- Thread_Control *the_thread
+ Scheduler_Control *base,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( base );
_Scheduler_priority_Ready_queue_enqueue( the_thread, &scheduler->Bit_map );
}
diff --git a/cpukit/score/src/schedulerpriorityenqueuefirst.c b/cpukit/score/src/schedulerpriorityenqueuefirst.c
index 8de06fa693..1f0605d70b 100644
--- a/cpukit/score/src/schedulerpriorityenqueuefirst.c
+++ b/cpukit/score/src/schedulerpriorityenqueuefirst.c
@@ -21,14 +21,16 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Enqueue_first(
- Thread_Control *the_thread
+ Scheduler_Control *base,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *self =
+ _Scheduler_priority_Self_from_base( base );
_Scheduler_priority_Ready_queue_enqueue_first(
the_thread,
- &scheduler->Bit_map
+ &self->Bit_map
);
}
diff --git a/cpukit/score/src/schedulerpriorityextract.c b/cpukit/score/src/schedulerpriorityextract.c
index e5888dc7d9..492c537a73 100644
--- a/cpukit/score/src/schedulerpriorityextract.c
+++ b/cpukit/score/src/schedulerpriorityextract.c
@@ -21,7 +21,10 @@
#include <rtems/score/schedulerpriorityimpl.h>
-void _Scheduler_priority_Extract( Thread_Control *the_thread )
+void _Scheduler_priority_Extract(
+ Scheduler_Control *base,
+ Thread_Control *the_thread
+)
{
- _Scheduler_priority_Extract_body( the_thread );
+ _Scheduler_priority_Extract_body( base, the_thread );
}
diff --git a/cpukit/score/src/schedulerpriorityfree.c b/cpukit/score/src/schedulerpriorityfree.c
index d494bd61d7..5529f78d59 100644
--- a/cpukit/score/src/schedulerpriorityfree.c
+++ b/cpukit/score/src/schedulerpriorityfree.c
@@ -25,8 +25,11 @@
#include <rtems/score/wkspace.h>
void _Scheduler_priority_Free (
+ Scheduler_Control *base,
Thread_Control *the_thread
)
{
+ (void) base;
+
_Workspace_Free( the_thread->scheduler_info );
}
diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
index 9b5bf844fc..6879d01ee4 100644
--- a/cpukit/score/src/schedulerpriorityprioritycompare.c
+++ b/cpukit/score/src/schedulerpriorityprioritycompare.c
@@ -21,8 +21,8 @@
#include <rtems/score/schedulerpriorityimpl.h>
int _Scheduler_priority_Priority_compare(
- Priority_Control p1,
- Priority_Control p2
+ Priority_Control p1,
+ Priority_Control p2
)
{
return _Scheduler_priority_Priority_compare_body( p1, p2 );
diff --git a/cpukit/score/src/schedulerpriorityschedule.c b/cpukit/score/src/schedulerpriorityschedule.c
index eb97779eb5..aa6c09a505 100644
--- a/cpukit/score/src/schedulerpriorityschedule.c
+++ b/cpukit/score/src/schedulerpriorityschedule.c
@@ -20,7 +20,10 @@
#include <rtems/score/schedulerpriorityimpl.h>
-void _Scheduler_priority_Schedule( Thread_Control *thread )
+void _Scheduler_priority_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *the_thread
+)
{
- _Scheduler_priority_Schedule_body( thread, false );
+ _Scheduler_priority_Schedule_body( base, the_thread, false );
}
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 458d87bdb7..5361023b4a 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -29,16 +29,17 @@
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_priority_SMP_Control *_Scheduler_priority_SMP_Instance( void )
+static Scheduler_priority_SMP_Control *
+_Scheduler_priority_SMP_Self_from_base( Scheduler_Control *base )
{
- return _Scheduler.information;
+ return (Scheduler_priority_SMP_Control *) base->information;
}
static Scheduler_priority_SMP_Control *
-_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *base )
+_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
{
return (Scheduler_priority_SMP_Control *)
- ( (char *) base
+ ( (char *) smp_base
- offsetof( Scheduler_priority_SMP_Control, Base ) );
}
@@ -55,9 +56,13 @@ void _Scheduler_priority_SMP_Initialize( void )
_Scheduler.information = self;
}
-void _Scheduler_priority_SMP_Update( Thread_Control *thread )
+void _Scheduler_priority_SMP_Update(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_priority_Update_body(
thread,
@@ -67,11 +72,11 @@ void _Scheduler_priority_SMP_Update( Thread_Control *thread )
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
- Scheduler_SMP_Control *base
+ Scheduler_SMP_Control *smp_base
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
Thread_Control *highest_ready = NULL;
if ( !_Priority_bit_map_Is_empty( &self->Bit_map ) ) {
@@ -85,12 +90,12 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
}
static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *scheduled_to_ready
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
_Scheduler_priority_Ready_queue_enqueue_first(
@@ -100,12 +105,12 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
}
static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *ready_to_scheduled
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_extract(
ready_to_scheduled,
@@ -118,34 +123,34 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
}
static void _Scheduler_priority_SMP_Insert_ready_lifo(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Insert_ready_fifo(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue_first( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Do_extract(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( base );
+ _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
bool is_scheduled = thread->is_scheduled;
thread->is_in_the_air = is_scheduled;
@@ -158,9 +163,13 @@ static void _Scheduler_priority_SMP_Do_extract(
}
}
-void _Scheduler_priority_SMP_Block( Thread_Control *thread )
+void _Scheduler_priority_SMP_Block(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_SMP_Block(
&self->Base,
@@ -191,9 +200,13 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
);
}
-void _Scheduler_priority_SMP_Enqueue_lifo( Thread_Control *thread )
+void _Scheduler_priority_SMP_Enqueue_lifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -204,9 +217,13 @@ void _Scheduler_priority_SMP_Enqueue_lifo( Thread_Control *thread )
);
}
-void _Scheduler_priority_SMP_Enqueue_fifo( Thread_Control *thread )
+void _Scheduler_priority_SMP_Enqueue_fifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -217,9 +234,13 @@ void _Scheduler_priority_SMP_Enqueue_fifo( Thread_Control *thread )
);
}
-void _Scheduler_priority_SMP_Extract( Thread_Control *thread )
+void _Scheduler_priority_SMP_Extract(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_SMP_Extract(
&self->Base,
@@ -228,21 +249,28 @@ void _Scheduler_priority_SMP_Extract( Thread_Control *thread )
);
}
-void _Scheduler_priority_SMP_Yield( Thread_Control *thread )
+void _Scheduler_priority_SMP_Yield(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
ISR_Level level;
_ISR_Disable( level );
- _Scheduler_priority_SMP_Extract( thread );
- _Scheduler_priority_SMP_Enqueue_fifo( thread );
+ _Scheduler_priority_SMP_Extract( base, thread );
+ _Scheduler_priority_SMP_Enqueue_fifo( base, thread );
_ISR_Enable( level );
}
-void _Scheduler_priority_SMP_Schedule( Thread_Control *thread )
+void _Scheduler_priority_SMP_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_SMP_Schedule(
&self->Base,
@@ -253,11 +281,13 @@ void _Scheduler_priority_SMP_Schedule( Thread_Control *thread )
}
void _Scheduler_priority_SMP_Start_idle(
+ Scheduler_Control *base,
Thread_Control *thread,
Per_CPU_Control *cpu
)
{
- Scheduler_priority_SMP_Control *self = _Scheduler_priority_SMP_Instance();
+ Scheduler_priority_SMP_Control *self =
+ _Scheduler_priority_SMP_Self_from_base( base );
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
diff --git a/cpukit/score/src/schedulerpriorityunblock.c b/cpukit/score/src/schedulerpriorityunblock.c
index f69c1e2689..c84111ca26 100644
--- a/cpukit/score/src/schedulerpriorityunblock.c
+++ b/cpukit/score/src/schedulerpriorityunblock.c
@@ -23,12 +23,14 @@
#include <rtems/score/schedulerpriorityimpl.h>
void _Scheduler_priority_Unblock (
- Thread_Control *the_thread
+ Scheduler_Control *base,
+ Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *self =
+ _Scheduler_priority_Self_from_base( base );
- _Scheduler_priority_Ready_queue_enqueue( the_thread, &scheduler->Bit_map );
+ _Scheduler_priority_Ready_queue_enqueue( the_thread, &self->Bit_map );
/* TODO: flash critical section? */
diff --git a/cpukit/score/src/schedulerpriorityupdate.c b/cpukit/score/src/schedulerpriorityupdate.c
index a56acd08d1..0e7032af71 100644
--- a/cpukit/score/src/schedulerpriorityupdate.c
+++ b/cpukit/score/src/schedulerpriorityupdate.c
@@ -19,17 +19,18 @@
#endif
#include <rtems/score/schedulerpriorityimpl.h>
-#include <rtems/score/thread.h>
void _Scheduler_priority_Update(
+ Scheduler_Control *base,
Thread_Control *the_thread
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *self =
+ _Scheduler_priority_Self_from_base( base );
_Scheduler_priority_Update_body(
the_thread,
- &scheduler->Bit_map,
- &scheduler->Ready[ 0 ]
+ &self->Bit_map,
+ &self->Ready[ 0 ]
);
}
diff --git a/cpukit/score/src/schedulerpriorityyield.c b/cpukit/score/src/schedulerpriorityyield.c
index 1e83c557cf..2bcefa5eb7 100644
--- a/cpukit/score/src/schedulerpriorityyield.c
+++ b/cpukit/score/src/schedulerpriorityyield.c
@@ -22,25 +22,30 @@
#include <rtems/score/isr.h>
#include <rtems/score/threadimpl.h>
-void _Scheduler_priority_Yield( Thread_Control *thread )
+void _Scheduler_priority_Yield(
+ Scheduler_Control *base,
+ Thread_Control *the_thread
+)
{
Scheduler_priority_Per_thread *sched_info_of_thread =
- _Scheduler_priority_Get_scheduler_info( thread );
+ _Scheduler_priority_Get_scheduler_info( the_thread );
Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
ISR_Level level;
+ (void) base;
+
_ISR_Disable( level );
if ( !_Chain_Has_only_one_node( ready_chain ) ) {
- _Chain_Extract_unprotected( &thread->Object.Node );
- _Chain_Append_unprotected( ready_chain, &thread->Object.Node );
+ _Chain_Extract_unprotected( &the_thread->Object.Node );
+ _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
_ISR_Flash( level );
- if ( _Thread_Is_heir( thread ) )
+ if ( _Thread_Is_heir( the_thread ) )
_Thread_Heir = (Thread_Control *) _Chain_First( ready_chain );
_Thread_Dispatch_necessary = true;
}
- else if ( !_Thread_Is_heir( thread ) )
+ else if ( !_Thread_Is_heir( the_thread ) )
_Thread_Dispatch_necessary = true;
_ISR_Enable( level );
diff --git a/cpukit/score/src/schedulersimpleblock.c b/cpukit/score/src/schedulersimpleblock.c
index ac2ab6bda9..8bfab69adf 100644
--- a/cpukit/score/src/schedulersimpleblock.c
+++ b/cpukit/score/src/schedulersimpleblock.c
@@ -22,12 +22,14 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Block(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
_Scheduler_Generic_block(
+ scheduler,
+ the_thread,
_Scheduler_simple_Extract,
- _Scheduler_simple_Schedule_body,
- the_thread
+ _Scheduler_simple_Schedule_body
);
}
diff --git a/cpukit/score/src/schedulersimpleenqueue.c b/cpukit/score/src/schedulersimpleenqueue.c
index e8ad4664fa..b0d49920c5 100644
--- a/cpukit/score/src/schedulersimpleenqueue.c
+++ b/cpukit/score/src/schedulersimpleenqueue.c
@@ -26,8 +26,9 @@
#include <rtems/score/schedulersimple.h>
void _Scheduler_simple_Enqueue(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler_simple_Ready_queue_enqueue( the_thread );
+ _Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
}
diff --git a/cpukit/score/src/schedulersimpleenqueuefirst.c b/cpukit/score/src/schedulersimpleenqueuefirst.c
index 486030875f..b9005a778b 100644
--- a/cpukit/score/src/schedulersimpleenqueuefirst.c
+++ b/cpukit/score/src/schedulersimpleenqueuefirst.c
@@ -24,8 +24,9 @@
#include <rtems/score/schedulersimple.h>
void _Scheduler_simple_Enqueue_first(
- Thread_Control *the_thread
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
)
{
- _Scheduler_simple_Ready_queue_enqueue_first( the_thread );
+ _Scheduler_simple_Ready_queue_enqueue_first( scheduler, the_thread );
}
diff --git a/cpukit/score/src/schedulersimpleextract.c b/cpukit/score/src/schedulersimpleextract.c
index ab38fb92f8..7bb4339ff3 100644
--- a/cpukit/score/src/schedulersimpleextract.c
+++ b/cpukit/score/src/schedulersimpleextract.c
@@ -24,8 +24,11 @@
#include <rtems/score/thread.h>
void _Scheduler_simple_Extract(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
+ (void) scheduler;
+
_Chain_Extract_unprotected( &the_thread->Object.Node );
}
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueue.c b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
index 134f6e8a7a..3e06a26b29 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueue.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueue.c
@@ -21,11 +21,12 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Ready_queue_enqueue(
+ Scheduler_Control *scheduler_base,
Thread_Control *the_thread
)
{
Scheduler_simple_Control *scheduler =
- _Scheduler_simple_Instance();
+ _Scheduler_simple_Self_from_base( scheduler_base );
_Scheduler_simple_Insert_priority_fifo( &scheduler->Ready, the_thread );
}
diff --git a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
index 841bcd1a64..dd3379fda5 100644
--- a/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
+++ b/cpukit/score/src/schedulersimplereadyqueueenqueuefirst.c
@@ -21,11 +21,12 @@
#include <rtems/score/schedulersimpleimpl.h>
void _Scheduler_simple_Ready_queue_enqueue_first(
+ Scheduler_Control *scheduler_base,
Thread_Control *the_thread
)
{
Scheduler_simple_Control *scheduler =
- _Scheduler_simple_Instance();
+ _Scheduler_simple_Self_from_base( scheduler_base );
_Scheduler_simple_Insert_priority_lifo( &scheduler->Ready, the_thread );
}
diff --git a/cpukit/score/src/schedulersimpleschedule.c b/cpukit/score/src/schedulersimpleschedule.c
index bf9372bac0..d3574b04cc 100644
--- a/cpukit/score/src/schedulersimpleschedule.c
+++ b/cpukit/score/src/schedulersimpleschedule.c
@@ -20,7 +20,10 @@
#include <rtems/score/schedulersimpleimpl.h>
-void _Scheduler_simple_Schedule( Thread_Control *thread )
+void _Scheduler_simple_Schedule(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
- _Scheduler_simple_Schedule_body( thread, false );
+ _Scheduler_simple_Schedule_body( scheduler, the_thread, false );
}
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index d222d02d42..20a35af07a 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -22,16 +22,17 @@
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_simple_SMP_Control *_Scheduler_simple_SMP_Instance( void )
+static Scheduler_simple_SMP_Control *
+_Scheduler_simple_SMP_Self_from_base( Scheduler_Control *base )
{
- return _Scheduler.information;
+ return (Scheduler_simple_SMP_Control *) base->information;
}
static Scheduler_simple_SMP_Control *
-_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *base )
+_Scheduler_simple_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
{
return (Scheduler_simple_SMP_Control *)
- ( (char *) base - offsetof( Scheduler_simple_SMP_Control, Base ) );
+ ( (char *) smp_base - offsetof( Scheduler_simple_SMP_Control, Base ) );
}
void _Scheduler_simple_smp_Initialize( void )
@@ -46,11 +47,11 @@ void _Scheduler_simple_smp_Initialize( void )
}
static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
- Scheduler_SMP_Control *base
+ Scheduler_SMP_Control *smp_base
)
{
Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_SMP_base( base );
+ _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
Thread_Control *highest_ready = NULL;
Chain_Control *ready = &self->Ready;
@@ -62,12 +63,12 @@ static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
}
static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *scheduled_to_ready
)
{
Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_SMP_base( base );
+ _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
_Scheduler_simple_Insert_priority_lifo(
@@ -77,24 +78,24 @@ static void _Scheduler_simple_smp_Move_from_scheduled_to_ready(
}
static void _Scheduler_simple_smp_Move_from_ready_to_scheduled(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *ready_to_scheduled
)
{
_Chain_Extract_unprotected( &ready_to_scheduled->Object.Node );
_Scheduler_simple_Insert_priority_fifo(
- &base->Scheduled,
+ &smp_base->Scheduled,
ready_to_scheduled
);
}
static void _Scheduler_simple_smp_Insert_ready_lifo(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_SMP_base( base );
+ _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Insert_ordered_unprotected(
&self->Ready,
@@ -104,12 +105,12 @@ static void _Scheduler_simple_smp_Insert_ready_lifo(
}
static void _Scheduler_simple_smp_Insert_ready_fifo(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
Scheduler_simple_SMP_Control *self =
- _Scheduler_simple_SMP_Self_from_SMP_base( base );
+ _Scheduler_simple_SMP_Self_from_SMP_base( smp_base );
_Chain_Insert_ordered_unprotected(
&self->Ready,
@@ -119,11 +120,11 @@ static void _Scheduler_simple_smp_Insert_ready_fifo(
}
static void _Scheduler_simple_smp_Do_extract(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread
)
{
- (void) base;
+ (void) smp_base;
thread->is_in_the_air = thread->is_scheduled;
thread->is_scheduled = false;
@@ -131,9 +132,13 @@ static void _Scheduler_simple_smp_Do_extract(
_Chain_Extract_unprotected( &thread->Object.Node );
}
-void _Scheduler_simple_smp_Block( Thread_Control *thread )
+void _Scheduler_simple_smp_Block(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_SMP_Block(
&self->Base,
@@ -145,7 +150,7 @@ void _Scheduler_simple_smp_Block( Thread_Control *thread )
}
static void _Scheduler_simple_smp_Enqueue_ordered(
- Scheduler_SMP_Control *base,
+ Scheduler_SMP_Control *smp_base,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
@@ -153,7 +158,7 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
)
{
_Scheduler_SMP_Enqueue_ordered(
- base,
+ smp_base,
thread,
order,
_Scheduler_simple_smp_Get_highest_ready,
@@ -164,9 +169,13 @@ static void _Scheduler_simple_smp_Enqueue_ordered(
);
}
-void _Scheduler_simple_smp_Enqueue_priority_lifo( Thread_Control *thread )
+void _Scheduler_simple_smp_Enqueue_priority_lifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_simple_smp_Enqueue_ordered(
&self->Base,
@@ -177,9 +186,13 @@ void _Scheduler_simple_smp_Enqueue_priority_lifo( Thread_Control *thread )
);
}
-void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread )
+void _Scheduler_simple_smp_Enqueue_priority_fifo(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_simple_smp_Enqueue_ordered(
&self->Base,
@@ -190,9 +203,13 @@ void _Scheduler_simple_smp_Enqueue_priority_fifo( Thread_Control *thread )
);
}
-void _Scheduler_simple_smp_Extract( Thread_Control *thread )
+void _Scheduler_simple_smp_Extract(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_SMP_Extract(
&self->Base,
@@ -201,21 +218,28 @@ void _Scheduler_simple_smp_Extract( Thread_Control *thread )
);
}
-void _Scheduler_simple_smp_Yield( Thread_Control *thread )
+void _Scheduler_simple_smp_Yield(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
ISR_Level level;
_ISR_Disable( level );
- _Scheduler_simple_smp_Extract( thread );
- _Scheduler_simple_smp_Enqueue_priority_fifo( thread );
+ _Scheduler_simple_smp_Extract( base, thread );
+ _Scheduler_simple_smp_Enqueue_priority_fifo( base, thread );
_ISR_Enable( level );
}
-void _Scheduler_simple_smp_Schedule( Thread_Control *thread )
+void _Scheduler_simple_smp_Schedule(
+ Scheduler_Control *base,
+ Thread_Control *thread
+)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_SMP_Schedule(
&self->Base,
@@ -226,11 +250,13 @@ void _Scheduler_simple_smp_Schedule( Thread_Control *thread )
}
void _Scheduler_simple_smp_Start_idle(
+ Scheduler_Control *base,
Thread_Control *thread,
Per_CPU_Control *cpu
)
{
- Scheduler_simple_SMP_Control *self = _Scheduler_simple_SMP_Instance();
+ Scheduler_simple_SMP_Control *self =
+ _Scheduler_simple_SMP_Self_from_base( base );
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}
diff --git a/cpukit/score/src/schedulersimpleunblock.c b/cpukit/score/src/schedulersimpleunblock.c
index 37a710de51..c669a9b616 100644
--- a/cpukit/score/src/schedulersimpleunblock.c
+++ b/cpukit/score/src/schedulersimpleunblock.c
@@ -24,10 +24,11 @@
#include <rtems/score/thread.h>
void _Scheduler_simple_Unblock(
+ Scheduler_Control *scheduler,
Thread_Control *the_thread
)
{
- _Scheduler_simple_Ready_queue_enqueue(the_thread);
+ _Scheduler_simple_Ready_queue_enqueue( scheduler, the_thread );
/*
* If the thread that was unblocked is more important than the heir,
diff --git a/cpukit/score/src/schedulersimpleyield.c b/cpukit/score/src/schedulersimpleyield.c
index 114071b556..664fa31c76 100644
--- a/cpukit/score/src/schedulersimpleyield.c
+++ b/cpukit/score/src/schedulersimpleyield.c
@@ -22,17 +22,20 @@
#include <rtems/score/isr.h>
#include <rtems/score/threadimpl.h>
-void _Scheduler_simple_Yield( Thread_Control *thread )
+void _Scheduler_simple_Yield(
+ Scheduler_Control *scheduler,
+ Thread_Control *the_thread
+)
{
ISR_Level level;
_ISR_Disable( level );
- _Scheduler_simple_Ready_queue_requeue( &_Scheduler, thread );
+ _Scheduler_simple_Ready_queue_requeue( scheduler, the_thread );
_ISR_Flash( level );
- _Scheduler_simple_Schedule_body( thread, false );
+ _Scheduler_simple_Schedule_body( scheduler, the_thread, false );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
index f60527a605..fab0c9e850 100644
--- a/cpukit/score/src/threadchangepriority.c
+++ b/cpukit/score/src/threadchangepriority.c
@@ -29,8 +29,9 @@ void _Thread_Change_priority(
bool prepend_it
)
{
- ISR_Level level;
- States_Control state, original_state;
+ Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
+ ISR_Level level;
+ States_Control state, original_state;
/*
* Save original state
@@ -69,7 +70,7 @@ void _Thread_Change_priority(
* result in a _Scheduler_Block() operation. Make sure we select an heir
* now.
*/
- _Scheduler_Schedule( the_thread );
+ _Scheduler_Schedule( scheduler, the_thread );
_ISR_Enable( level );
if ( _States_Is_waiting_on_thread_queue( state ) ) {
@@ -89,9 +90,9 @@ void _Thread_Change_priority(
the_thread->current_state = _States_Clear( STATES_TRANSIENT, state );
if ( prepend_it )
- _Scheduler_Enqueue_first( the_thread );
+ _Scheduler_Enqueue_first( scheduler, the_thread );
else
- _Scheduler_Enqueue( the_thread );
+ _Scheduler_Enqueue( scheduler, the_thread );
}
_ISR_Flash( level );
@@ -100,7 +101,7 @@ void _Thread_Change_priority(
* We altered the set of thread priorities. So let's figure out
* who is the heir and if we need to switch to them.
*/
- _Scheduler_Schedule( the_thread );
+ _Scheduler_Schedule( scheduler, the_thread );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/threadclearstate.c b/cpukit/score/src/threadclearstate.c
index 19e41df593..10bdae6829 100644
--- a/cpukit/score/src/threadclearstate.c
+++ b/cpukit/score/src/threadclearstate.c
@@ -37,7 +37,7 @@ void _Thread_Clear_state(
the_thread->current_state = _States_Clear( state, current_state );
if ( _States_Is_ready( current_state ) ) {
- _Scheduler_Unblock( the_thread );
+ _Scheduler_Unblock( _Scheduler_Get( the_thread ), the_thread );
}
}
_ISR_Enable( level );
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 35ddd2a09b..cf96c24bcd 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -215,7 +215,7 @@ bool _Thread_Initialize(
the_thread->resource_count = 0;
the_thread->real_priority = priority;
the_thread->Start.initial_priority = priority;
- sched =_Scheduler_Allocate( the_thread );
+ sched =_Scheduler_Allocate( _Scheduler_Get( the_thread ), the_thread );
if ( !sched )
goto failed;
_Thread_Set_priority( the_thread, priority );
diff --git a/cpukit/score/src/threadready.c b/cpukit/score/src/threadready.c
index b79d8db84d..d50debeff5 100644
--- a/cpukit/score/src/threadready.c
+++ b/cpukit/score/src/threadready.c
@@ -32,7 +32,7 @@ void _Thread_Ready(
the_thread->current_state = STATES_READY;
- _Scheduler_Unblock( the_thread );
+ _Scheduler_Unblock( _Scheduler_Get( the_thread ), the_thread );
_ISR_Enable( level );
}
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 02371acfdb..fcf9d6ce3e 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -71,7 +71,7 @@ static void _Thread_Free( Thread_Control *the_thread )
/*
* Free the per-thread scheduling information.
*/
- _Scheduler_Free( the_thread );
+ _Scheduler_Free( _Scheduler_Get( the_thread ), the_thread );
/*
* The thread might have been FP. So deal with that.
@@ -216,8 +216,9 @@ void _Thread_Life_action_handler(
}
static void _Thread_Start_life_change(
- Thread_Control *the_thread,
- Priority_Control priority
+ Thread_Control *the_thread,
+ Scheduler_Control *scheduler,
+ Priority_Control priority
)
{
the_thread->is_preemptible = the_thread->Start.is_preemptible;
@@ -228,7 +229,7 @@ static void _Thread_Start_life_change(
_Thread_Set_transient( the_thread );
_Thread_queue_Extract_with_proxy( the_thread );
_Watchdog_Remove( &the_thread->Timer );
- _Scheduler_Set_priority_if_higher( the_thread, priority );
+ _Scheduler_Set_priority_if_higher( scheduler, the_thread, priority );
_Thread_Add_post_switch_action( the_thread, &the_thread->Life.Action );
_Thread_Ready( the_thread );
_Thread_Request_dispatch_if_executing( the_thread );
@@ -244,29 +245,37 @@ static void _Thread_Request_life_change(
Thread_Life_state previous_life_state;
Per_CPU_Control *cpu;
ISR_Level level;
+ Scheduler_Control *scheduler;
cpu = _Thread_Action_ISR_disable_and_acquire( the_thread, &level );
previous_life_state = the_thread->Life.state;
the_thread->Life.state = previous_life_state | additional_life_state;
_Thread_Action_release_and_ISR_enable( cpu, level );
+ scheduler = _Scheduler_Get( the_thread );
if ( the_thread == executing ) {
executing->real_priority = priority;
- _Scheduler_Set_priority_if_higher( the_thread, priority );
+ _Scheduler_Set_priority_if_higher( scheduler, the_thread, priority );
_Thread_Start_life_change_for_executing( executing );
} else if ( previous_life_state == THREAD_LIFE_NORMAL ) {
- _Thread_Start_life_change( the_thread, priority );
+ _Thread_Start_life_change( the_thread, scheduler, priority );
} else {
_Thread_Clear_state( the_thread, STATES_SUSPENDED );
if ( _Thread_Is_life_terminating( additional_life_state ) ) {
the_thread->real_priority = _Scheduler_Highest_priority_of_two(
+ scheduler,
the_thread->real_priority,
priority
);
- _Scheduler_Change_priority_if_higher( the_thread, priority, false );
+ _Scheduler_Change_priority_if_higher(
+ scheduler,
+ the_thread,
+ priority,
+ false
+ );
}
}
}
diff --git a/cpukit/score/src/threadsetpriority.c b/cpukit/score/src/threadsetpriority.c
index 99d0c4a0ff..e1286480a4 100644
--- a/cpukit/score/src/threadsetpriority.c
+++ b/cpukit/score/src/threadsetpriority.c
@@ -28,5 +28,5 @@ void _Thread_Set_priority(
{
the_thread->current_priority = new_priority;
- _Scheduler_Update( the_thread );
+ _Scheduler_Update( _Scheduler_Get( the_thread ), the_thread );
}
diff --git a/cpukit/score/src/threadsetstate.c b/cpukit/score/src/threadsetstate.c
index a8cd38efc7..97da2bf197 100644
--- a/cpukit/score/src/threadsetstate.c
+++ b/cpukit/score/src/threadsetstate.c
@@ -39,7 +39,7 @@ void _Thread_Set_state(
if ( _States_Is_ready( current_state ) ) {
the_thread->current_state = state;
- _Scheduler_Block( the_thread );
+ _Scheduler_Block( _Scheduler_Get( the_thread ), the_thread );
} else {
the_thread->current_state = _States_Set( state, current_state);
}
diff --git a/cpukit/score/src/threadsettransient.c b/cpukit/score/src/threadsettransient.c
index c0d31fefe8..ead3c452a3 100644
--- a/cpukit/score/src/threadsettransient.c
+++ b/cpukit/score/src/threadsettransient.c
@@ -36,7 +36,7 @@ void _Thread_Set_transient(
the_thread->current_state = _States_Set( STATES_TRANSIENT, old_state );
if ( _States_Is_ready( old_state ) ) {
- _Scheduler_Extract( the_thread );
+ _Scheduler_Extract( _Scheduler_Get( the_thread ), the_thread );
}
_ISR_Enable( level );
diff --git a/cpukit/score/src/threadstart.c b/cpukit/score/src/threadstart.c
index 5b9604e264..b65a2c3380 100644
--- a/cpukit/score/src/threadstart.c
+++ b/cpukit/score/src/threadstart.c
@@ -30,7 +30,7 @@ bool _Thread_Start(
void *entry_point,
void *pointer_argument,
Thread_Entry_numeric_type numeric_argument,
- Per_CPU_Control *processor
+ Per_CPU_Control *cpu
)
{
if ( _States_Is_dormant( the_thread->current_state ) ) {
@@ -43,11 +43,11 @@ bool _Thread_Start(
_Thread_Load_environment( the_thread );
- if ( processor == NULL ) {
+ if ( cpu == NULL ) {
_Thread_Ready( the_thread );
} else {
the_thread->current_state = STATES_READY;
- _Scheduler_Start_idle( the_thread, processor );
+ _Scheduler_Start_idle( _Scheduler_Get( the_thread ), the_thread, cpu );
}
_User_extensions_Thread_start( the_thread );
diff --git a/testsuites/tmtests/tm26/task1.c b/testsuites/tmtests/tm26/task1.c
index 925c2f501b..6325516561 100644
--- a/testsuites/tmtests/tm26/task1.c
+++ b/testsuites/tmtests/tm26/task1.c
@@ -371,7 +371,8 @@ rtems_task Middle_task(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
thread_dispatch_no_fp_time = benchmark_timer_read();
@@ -403,7 +404,8 @@ rtems_task Low_task(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
Thread_Control *executing;
context_switch_no_fp_time = benchmark_timer_read();
@@ -445,7 +447,8 @@ rtems_task Floating_point_task_1(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
Thread_Control *executing;
FP_DECLARE;
@@ -500,7 +503,8 @@ rtems_task Floating_point_task_2(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
Thread_Control *executing;
FP_DECLARE;
diff --git a/testsuites/tmtests/tm27/task1.c b/testsuites/tmtests/tm27/task1.c
index d7ebfbe224..a6393273f2 100644
--- a/testsuites/tmtests/tm27/task1.c
+++ b/testsuites/tmtests/tm27/task1.c
@@ -102,7 +102,8 @@ rtems_task Task_1(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
#if defined(RTEMS_SMP)
rtems_interrupt_level level;
#endif
@@ -219,7 +220,8 @@ rtems_task Task_2(
rtems_task_argument argument
)
{
- Scheduler_priority_Control *scheduler = _Scheduler_priority_Instance();
+ Scheduler_priority_Control *scheduler =
+ _Scheduler_priority_Self_from_base( _Scheduler_Get( NULL ) );
#if defined(RTEMS_SMP)
rtems_interrupt_level level;
#endif