65,12 → 65,18 |
return ta; |
} |
|
static int verify_thread(thread_t *t) |
/** |
* Verify that thread t is valid for debugging ops. |
* |
* Verifies that t belongs to task ta and that debugging operations |
* may be used on it. |
* |
* Thread t's lock must already be held and interrupts must be disabled. |
*/ |
static int verify_thread(thread_t *t, task_t *ta) |
{ |
/* Verify that 't' exists and belongs to task 'ta' */ |
if (!thread_exists(t) || (t->task != ta)) { |
spinlock_unlock(&threads_lock); |
interrupts_restore(ipl); |
return ENOENT; |
} |
|
82,8 → 88,6 |
|
if ((t->debug_active != true) || (t->debug_stop != true)) { |
/* Not in debugging session or already has GO */ |
spinlock_unlock(&threads_lock); |
interrupts_restore(ipl); |
return EBUSY; |
} |
|
262,7 → 266,7 |
spinlock_lock(&threads_lock); |
|
/* Verify that thread t exists and may be operated on */ |
rc = verify_thread(t); |
rc = verify_thread(t, ta); |
if (rc != EOK) { |
spinlock_unlock(&threads_lock); |
interrupts_restore(ipl); |
315,7 → 319,7 |
t = (thread_t *) IPC_GET_ARG2(call->data); |
|
/* Verify that thread t exists and may be operated on */ |
rc = verify_thread(t); |
rc = verify_thread(t, ta); |
if (rc != EOK) { |
spinlock_unlock(&threads_lock); |
interrupts_restore(ipl); |
390,7 → 394,7 |
t = (thread_t *) IPC_GET_ARG2(call->data); |
|
/* Verify that thread t exists and may be operated on */ |
rc = verify_thread(t); |
rc = verify_thread(t, ta); |
if (rc != EOK) { |
spinlock_unlock(&threads_lock); |
interrupts_restore(ipl); |