summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulerprioritysmp.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-13 15:08:07 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-05-14 14:46:20 +0200
commit3730a07fac4c66e9f01c4c620fec33b93a3aff3b (patch)
tree55158d0ca0e31cfc14994a5f05e2d24ae0591df4 /cpukit/score/src/schedulerprioritysmp.c
parentscore: Capitalize SMP acronym (diff)
downloadrtems-3730a07fac4c66e9f01c4c620fec33b93a3aff3b.tar.bz2
score: Use Scheduler_Context for SMP scheduler
Use the basic Scheduler_Context for the general SMP scheduler operations to avoid usage of structure offsets to get the specialized context variants.
Diffstat (limited to 'cpukit/score/src/schedulerprioritysmp.c')
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c46
1 files changed, 22 insertions, 24 deletions
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 263bc8746d..98ff454564 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -36,11 +36,9 @@ _Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
}
static Scheduler_priority_SMP_Context *
-_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
+_Scheduler_priority_SMP_Get_self( Scheduler_Context *context )
{
- return (Scheduler_priority_SMP_Context *)
- ( (char *) smp_base
- - offsetof( Scheduler_priority_SMP_Context, Base ) );
+ return (Scheduler_priority_SMP_Context *) context;
}
static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
@@ -91,11 +89,11 @@ void _Scheduler_priority_SMP_Update(
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
- Scheduler_SMP_Context *smp_base
+ Scheduler_Context *context
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Thread_Control *highest_ready = NULL;
if ( !_Priority_bit_map_Is_empty( &self->Bit_map ) ) {
@@ -109,12 +107,12 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
}
static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
- Scheduler_SMP_Context *smp_base,
+ Scheduler_Context *context,
Thread_Control *scheduled_to_ready
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Scheduler_priority_SMP_Node *node =
_Scheduler_priority_SMP_Node_get( scheduled_to_ready );
@@ -127,12 +125,12 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
}
static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
- Scheduler_SMP_Context *smp_base,
+ Scheduler_Context *context,
Thread_Control *ready_to_scheduled
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Scheduler_priority_SMP_Node *node =
_Scheduler_priority_SMP_Node_get( ready_to_scheduled );
@@ -148,12 +146,12 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
}
static void _Scheduler_priority_SMP_Insert_ready_lifo(
- Scheduler_SMP_Context *smp_base,
+ Scheduler_Context *context,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Scheduler_priority_SMP_Node *node =
_Scheduler_priority_SMP_Node_get( thread );
@@ -165,12 +163,12 @@ static void _Scheduler_priority_SMP_Insert_ready_lifo(
}
static void _Scheduler_priority_SMP_Insert_ready_fifo(
- Scheduler_SMP_Context *smp_base,
+ Scheduler_Context *context,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Scheduler_priority_SMP_Node *node =
_Scheduler_priority_SMP_Node_get( thread );
@@ -182,12 +180,12 @@ static void _Scheduler_priority_SMP_Insert_ready_fifo(
}
static void _Scheduler_priority_SMP_Do_extract(
- Scheduler_SMP_Context *smp_base,
+ Scheduler_Context *context,
Thread_Control *thread
)
{
Scheduler_priority_SMP_Context *self =
- _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
+ _Scheduler_priority_SMP_Get_self( context );
Scheduler_priority_SMP_Node *node =
_Scheduler_priority_SMP_Node_get( thread );
@@ -219,7 +217,7 @@ void _Scheduler_priority_SMP_Block(
_Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Block(
- &self->Base,
+ &self->Base.Base,
thread,
_Scheduler_priority_SMP_Do_extract,
_Scheduler_priority_SMP_Get_highest_ready,
@@ -228,7 +226,7 @@ void _Scheduler_priority_SMP_Block(
}
static void _Scheduler_priority_SMP_Enqueue_ordered(
- Scheduler_SMP_Context *self,
+ Scheduler_Context *context,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
@@ -236,7 +234,7 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
)
{
_Scheduler_SMP_Enqueue_ordered(
- self,
+ context,
thread,
order,
_Scheduler_priority_SMP_Get_highest_ready,
@@ -256,7 +254,7 @@ void _Scheduler_priority_SMP_Enqueue_lifo(
_Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
- &self->Base,
+ &self->Base.Base,
thread,
_Scheduler_simple_Insert_priority_lifo_order,
_Scheduler_priority_SMP_Insert_ready_lifo,
@@ -273,7 +271,7 @@ void _Scheduler_priority_SMP_Enqueue_fifo(
_Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
- &self->Base,
+ &self->Base.Base,
thread,
_Scheduler_simple_Insert_priority_fifo_order,
_Scheduler_priority_SMP_Insert_ready_fifo,
@@ -290,7 +288,7 @@ void _Scheduler_priority_SMP_Extract(
_Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Extract(
- &self->Base,
+ &self->Base.Base,
thread,
_Scheduler_priority_SMP_Do_extract
);
@@ -320,7 +318,7 @@ void _Scheduler_priority_SMP_Schedule(
_Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Schedule(
- &self->Base,
+ &self->Base.Base,
thread,
_Scheduler_priority_SMP_Get_highest_ready,
_Scheduler_priority_SMP_Move_from_ready_to_scheduled
@@ -336,5 +334,5 @@ void _Scheduler_priority_SMP_Start_idle(
Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Get_context( scheduler );
- _Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
+ _Scheduler_SMP_Start_idle( &self->Base.Base, thread, cpu );
}