-/* Useful lock macros */
-
-#define pset_lock(pset) mutex_lock(&(pset)->lock)
-#define pset_lock_try(pset) mutex_try(&(pset)->lock)
-#define pset_unlock(pset) mutex_unlock(&(pset)->lock)
-
-#define processor_lock(pr) simple_lock(&(pr)->lock)
-#define processor_unlock(pr) simple_unlock(&(pr)->lock)
-
-extern void processor_bootstrap(void);
+/* Lock macros */
+
+#define pset_lock(p) simple_lock(&(p)->sched_lock)
+#define pset_unlock(p) simple_unlock(&(p)->sched_lock)
+#define pset_lock_init(p) simple_lock_init(&(p)->sched_lock, 0)
+
+/* Update hints */
+
+#define pset_pri_hint(ps, p, pri) \
+MACRO_BEGIN \
+ if ((p) != (ps)->low_pri) { \
+ if ((pri) < (ps)->low_pri->current_pri) \
+ (ps)->low_pri = (p); \
+ else \
+ if ((ps)->low_pri->state < PROCESSOR_IDLE) \
+ (ps)->low_pri = (p); \
+ } \
+MACRO_END
+
+#define pset_count_hint(ps, p, cnt) \
+MACRO_BEGIN \
+ if ((p) != (ps)->low_count) { \
+ if ((cnt) < SCHED(processor_runq_count)((ps)->low_count)) \
+ (ps)->low_count = (p); \
+ else \
+ if ((ps)->low_count->state < PROCESSOR_IDLE) \
+ (ps)->low_count = (p); \
+ } \
+MACRO_END
+
+#define pset_pri_init_hint(ps, p) \
+MACRO_BEGIN \
+ (ps)->low_pri = (p); \
+MACRO_END
+
+#define pset_count_init_hint(ps, p) \
+MACRO_BEGIN \
+ (ps)->low_count = (p); \
+MACRO_END
+
+
+extern void processor_bootstrap(void) __attribute__((section("__TEXT, initcode")));