summaryrefslogtreecommitdiff
path: root/firmware/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/kernel')
-rw-r--r--firmware/kernel/mrsw_lock.c4
-rw-r--r--firmware/kernel/mutex.c2
-rw-r--r--firmware/kernel/queue.c10
-rw-r--r--firmware/kernel/semaphore.c2
-rw-r--r--firmware/kernel/thread.c2
5 files changed, 20 insertions, 0 deletions
diff --git a/firmware/kernel/mrsw_lock.c b/firmware/kernel/mrsw_lock.c
index b683f63d5f..6120666d05 100644
--- a/firmware/kernel/mrsw_lock.c
+++ b/firmware/kernel/mrsw_lock.c
@@ -159,6 +159,8 @@ void mrsw_init(struct mrsw_lock *mrsw)
159 * access recursively. The current writer is ignored and gets access. */ 159 * access recursively. The current writer is ignored and gets access. */
160void mrsw_read_acquire(struct mrsw_lock *mrsw) 160void mrsw_read_acquire(struct mrsw_lock *mrsw)
161{ 161{
162 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT);
163
162 struct thread_entry *current = __running_self_entry(); 164 struct thread_entry *current = __running_self_entry();
163 165
164 if (current == mrsw->splay.blocker.thread IF_PRIO( && mrsw->count < 0 )) 166 if (current == mrsw->splay.blocker.thread IF_PRIO( && mrsw->count < 0 ))
@@ -268,6 +270,8 @@ void mrsw_read_release(struct mrsw_lock *mrsw)
268 * safely call recursively. */ 270 * safely call recursively. */
269void mrsw_write_acquire(struct mrsw_lock *mrsw) 271void mrsw_write_acquire(struct mrsw_lock *mrsw)
270{ 272{
273 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT);
274
271 struct thread_entry *current = __running_self_entry(); 275 struct thread_entry *current = __running_self_entry();
272 276
273 if (current == mrsw->splay.blocker.thread) 277 if (current == mrsw->splay.blocker.thread)
diff --git a/firmware/kernel/mutex.c b/firmware/kernel/mutex.c
index cb9e6816b8..b1ae3e9e54 100644
--- a/firmware/kernel/mutex.c
+++ b/firmware/kernel/mutex.c
@@ -39,6 +39,8 @@ void mutex_init(struct mutex *m)
39/* Gain ownership of a mutex object or block until it becomes free */ 39/* Gain ownership of a mutex object or block until it becomes free */
40void mutex_lock(struct mutex *m) 40void mutex_lock(struct mutex *m)
41{ 41{
42 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT);
43
42 struct thread_entry *current = __running_self_entry(); 44 struct thread_entry *current = __running_self_entry();
43 45
44 if(current == m->blocker.thread) 46 if(current == m->blocker.thread)
diff --git a/firmware/kernel/queue.c b/firmware/kernel/queue.c
index 927e55274c..70dba46c0a 100644
--- a/firmware/kernel/queue.c
+++ b/firmware/kernel/queue.c
@@ -283,6 +283,9 @@ void queue_wait(struct event_queue *q, struct queue_event *ev)
283#endif 283#endif
284 284
285 oldlevel = disable_irq_save(); 285 oldlevel = disable_irq_save();
286
287 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT, oldlevel);
288
286 corelock_lock(&q->cl); 289 corelock_lock(&q->cl);
287 290
288#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 291#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
@@ -335,6 +338,10 @@ void queue_wait_w_tmo(struct event_queue *q, struct queue_event *ev, int ticks)
335#endif 338#endif
336 339
337 oldlevel = disable_irq_save(); 340 oldlevel = disable_irq_save();
341
342 if (ticks != TIMEOUT_NOBLOCK)
343 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT, oldlevel);
344
338 corelock_lock(&q->cl); 345 corelock_lock(&q->cl);
339 346
340#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME 347#ifdef HAVE_EXTENDED_MESSAGING_AND_NAME
@@ -421,6 +428,9 @@ intptr_t queue_send(struct event_queue *q, long id, intptr_t data)
421 unsigned int wr; 428 unsigned int wr;
422 429
423 oldlevel = disable_irq_save(); 430 oldlevel = disable_irq_save();
431
432 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT, oldlevel);
433
424 corelock_lock(&q->cl); 434 corelock_lock(&q->cl);
425 435
426 wr = q->write++ & QUEUE_LENGTH_MASK; 436 wr = q->write++ & QUEUE_LENGTH_MASK;
diff --git a/firmware/kernel/semaphore.c b/firmware/kernel/semaphore.c
index 5e9e46798f..6b58fa3d8a 100644
--- a/firmware/kernel/semaphore.c
+++ b/firmware/kernel/semaphore.c
@@ -57,6 +57,8 @@ int semaphore_wait(struct semaphore *s, int timeout)
57 } 57 }
58 else if(timeout != 0) 58 else if(timeout != 0)
59 { 59 {
60 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT, oldlevel);
61
60 /* too many waits - block until count is upped... */ 62 /* too many waits - block until count is upped... */
61 struct thread_entry *current = __running_self_entry(); 63 struct thread_entry *current = __running_self_entry();
62 64
diff --git a/firmware/kernel/thread.c b/firmware/kernel/thread.c
index ea76421389..29ab9db873 100644
--- a/firmware/kernel/thread.c
+++ b/firmware/kernel/thread.c
@@ -1234,6 +1234,8 @@ unsigned int create_thread(void (*function)(void),
1234 */ 1234 */
1235void thread_wait(unsigned int thread_id) 1235void thread_wait(unsigned int thread_id)
1236{ 1236{
1237 ASSERT_CPU_MODE(CPU_MODE_THREAD_CONTEXT);
1238
1237 struct thread_entry *current = __running_self_entry(); 1239 struct thread_entry *current = __running_self_entry();
1238 struct thread_entry *thread = __thread_id_entry(thread_id); 1240 struct thread_entry *thread = __thread_id_entry(thread_id);
1239 1241