1 diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
2 index 0d07a9a..a241768 100644
3 --- a/cpukit/score/include/rtems/score/scheduler.h
4 +++ b/cpukit/score/include/rtems/score/scheduler.h
5 @@ -74,6 +74,10 @@ typedef struct {
7 /** extract a thread from the ready set */
8 void ( *extract )(Thread_Control *);
10 + /** compares two priorities (returns 1 for p1>p2, 0 for p1==p2
11 + * and -1 for p1<p2) */
12 + int ( *priority_compare )(Priority_Control, Priority_Control);
13 } Scheduler_Operations;
16 diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
17 index 3a75dee..a14be2e 100644
18 --- a/cpukit/score/include/rtems/score/schedulerpriority.h
19 +++ b/cpukit/score/include/rtems/score/schedulerpriority.h
20 @@ -48,7 +48,8 @@ extern "C" {
21 _Scheduler_priority_Update, /* update entry point */ \
22 _Scheduler_priority_Enqueue, /* enqueue entry point */ \
23 _Scheduler_priority_Enqueue_first, /* enqueue_first entry point */ \
24 - _Scheduler_priority_Extract /* extract entry point */ \
25 + _Scheduler_priority_Extract, /* extract entry point */ \
26 + _Scheduler_priority_Priority_compare /* compares two priorities */ \
30 @@ -171,6 +172,15 @@ void _Scheduler_priority_Extract(
34 + * This routine compares two priorities.
36 +int _Scheduler_priority_Priority_compare(
37 + Priority_Control p1,
43 * This is the major bit map.
45 extern volatile Priority_bit_map_Control _Priority_Major_bit_map;
46 diff --git a/cpukit/score/inline/rtems/score/scheduler.inl b/cpukit/score/inline/rtems/score/scheduler.inl
47 index c2d3dd3..128f901 100644
48 --- a/cpukit/score/inline/rtems/score/scheduler.inl
49 +++ b/cpukit/score/inline/rtems/score/scheduler.inl
50 @@ -159,6 +159,18 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Extract(
51 _Scheduler.Operations.extract( the_thread );
54 +/** @brief _Scheduler_Priority_compare
56 + * This routine compares two priorities
58 +RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
59 + Priority_Control p1,
63 + _Scheduler.Operations.priority_compare(p1, p2);
69 diff --git a/cpukit/score/inline/rtems/score/schedulerpriority.inl b/cpukit/score/inline/rtems/score/schedulerpriority.inl
70 index 02e21a2..c1094d3 100644
71 --- a/cpukit/score/inline/rtems/score/schedulerpriority.inl
72 +++ b/cpukit/score/inline/rtems/score/schedulerpriority.inl
73 @@ -189,6 +189,25 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Schedule_body(void)
79 + * @brief _Scheduler_priority_Priority_compare_body
81 + * This routine implements priority comparison for priority-based
84 +RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
85 + Priority_Control p1,
89 + if (p1 > p2) return 1;
90 + else if (p1 < p2) return -1;
99 diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
100 index b692d0f..0f62659 100644
101 --- a/cpukit/score/src/coremutexseize.c
102 +++ b/cpukit/score/src/coremutexseize.c
103 @@ -61,7 +61,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
105 executing = _Thread_Executing;
106 if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
107 - if ( the_mutex->holder->current_priority > executing->current_priority ) {
108 + if ( _Scheduler_Priority_compare(the_mutex->holder->current_priority, executing->current_priority) == 1 ) {
109 _Thread_Change_priority(
111 executing->current_priority,
112 diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
114 index 0000000..8bf86d4
116 +++ b/cpukit/score/src/schedulerpriorityprioritycompare.c
118 +/* Scheduler Simple Handler / Priority compare
120 + * COPYRIGHT (c) 2011.
121 + * On-Line Applications Research Corporation (OAR).
123 + * The license and distribution terms for this file may be
124 + * found in the file LICENSE in this distribution or at
125 + * http://www.rtems.com/license/LICENSE.
127 + * $Id: schedulerpriorityprioritycompare.c,v 1.2 2011/02/28 00:10:38 joel Exp $
134 +#include <rtems/system.h>
135 +#include <rtems/config.h>
136 +#include <rtems/score/chain.h>
137 +#include <rtems/score/schedulerpriority.h>
139 +void _Scheduler_priority_Priority_compare(
140 + Priority_Control p1,
141 + Priority_Control p2
144 + _Scheduler_priority_Priority_compare_body( p1, p2 );