Subversion Repositories HelenOS

Rev

Rev 2815 | Rev 2817 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2815 Rev 2816
Line 30... Line 30...
30
    spinlock_lock(&ta->lock);
30
    spinlock_lock(&ta->lock);
31
 
31
 
32
    return ta;
32
    return ta;
33
}
33
}
34
 
34
 
35
static thread_t *get_task_thread_by_id(task_t *ta, thread_id_t tid)
-
 
36
{
-
 
37
    thread_t *t;
-
 
38
    link_t *cur;
-
 
39
 
-
 
40
    for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) {
-
 
41
        t = list_get_instance(cur, thread_t, th_link);     
-
 
42
        if (tid == t->tid) return t;
-
 
43
    }
-
 
44
 
-
 
45
    return NULL;
-
 
46
}
-
 
47
 
-
 
48
static int udebug_rp_begin(call_t *call, phone_t *phone)
35
static int udebug_rp_begin(call_t *call, phone_t *phone)
49
{
36
{
50
    task_t *ta;
37
    task_t *ta;
51
 
38
 
52
    klog_printf("debug_begin()");
39
    klog_printf("debug_begin()");
Line 84... Line 71...
84
    task_t *ta;
71
    task_t *ta;
85
 
72
 
86
    klog_printf("debug_go()");
73
    klog_printf("debug_go()");
87
    ta = get_lock_callee_task(phone);
74
    ta = get_lock_callee_task(phone);
88
 
75
 
-
 
76
    // FIXME: must save this in thread struct, not task struct!!!
89
    ta->debug_go_call = call;
77
    ta->debug_go_call = call;
90
    t = get_task_thread_by_id(ta, IPC_GET_ARG2(call->data));
78
    t = (thread_t *) IPC_GET_ARG2(call->data);
91
    if (t == NULL) {
79
    if (!thread_exists(t)) {
92
        spinlock_unlock(&ta->lock);
80
        spinlock_unlock(&ta->lock);
93
        return ENOENT;
81
        return ENOENT;
94
    }
82
    }
95
 
83
 
96
    klog_printf("debug_go(): waitq_wakeup");
84
    klog_printf("debug_go(): waitq_wakeup");
Line 112... Line 100...
112
    klog_printf("debug_args_read()");
100
    klog_printf("debug_args_read()");
113
    // FIXME: verify task/thread state
101
    // FIXME: verify task/thread state
114
 
102
 
115
    ta = get_lock_callee_task(phone);
103
    ta = get_lock_callee_task(phone);
116
    klog_printf("task %llu", ta->taskid);
104
    klog_printf("task %llu", ta->taskid);
117
    t = get_task_thread_by_id(ta, IPC_GET_ARG2(call->data));
105
    t = (thread_t *) IPC_GET_ARG2(call->data);
118
    if (t == NULL) {
106
    if (!thread_exists(t)) {
119
        spinlock_unlock(&ta->lock);
107
        spinlock_unlock(&ta->lock);
120
        return ENOENT;
108
        return ENOENT;
121
    }
109
    }
122
 
110
 
123
    uspace_buffer = (void *)IPC_GET_ARG3(call->data);
111
    uspace_buffer = (void *)IPC_GET_ARG3(call->data);
Line 166... Line 154...
166
 
154
 
167
        /* Not interested in kernel threads */
155
        /* Not interested in kernel threads */
168
        if ((t->flags & THREAD_FLAG_USPACE) == 0)
156
        if ((t->flags & THREAD_FLAG_USPACE) == 0)
169
            continue;
157
            continue;
170
 
158
 
171
        //FIXME: id cropped!!
159
        /* Using thread struct pointer for identification */
172
        tid = (unative_t) t->tid;
160
        tid = (unative_t) t;
173
 
161
 
174
        to_copy = sizeof(unative_t);
162
        to_copy = sizeof(unative_t);
175
        if (copied + to_copy >= buf_size)
163
        if (copied + to_copy >= buf_size)
176
            to_copy = buf_size - copied;
164
            to_copy = buf_size - copied;
177
 
165