summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src
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 /cpukit/score/src
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.
Diffstat (limited to 'cpukit/score/src')
-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
55 files changed, 361 insertions, 184 deletions
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 );