Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2841 → Rev 2842

/branches/tracing/kernel/generic/src/udebug/udebug_ipc.c
65,16 → 65,22
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;
}
 
/* Verify that 't' is a userspace thread */
/* Verify that 't' is a userspace thread */
if ((t->flags & THREAD_FLAG_USPACE) == 0) {
/* It's not, deny its existence */
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);