Rev 2833 | Rev 2835 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2833 | Rev 2834 | ||
---|---|---|---|
Line 116... | Line 116... | ||
116 | rc ? "backsend" : "stoppability wait"); |
116 | rc ? "backsend" : "stoppability wait"); |
117 | 117 | ||
118 | return rc; |
118 | return rc; |
119 | } |
119 | } |
120 | 120 | ||
- | 121 | static int udebug_rp_end(call_t *call, phone_t *phone) |
|
- | 122 | { |
|
- | 123 | task_t *ta; |
|
- | 124 | ipl_t ipl; |
|
- | 125 | ||
- | 126 | thread_t *t; |
|
- | 127 | link_t *cur; |
|
- | 128 | ||
- | 129 | klog_printf("udebug_rp_end()"); |
|
- | 130 | ||
- | 131 | ipl = interrupts_disable(); |
|
- | 132 | ta = get_lock_callee_task(phone); |
|
- | 133 | klog_printf("task %llu", ta->taskid); |
|
- | 134 | ||
- | 135 | //TODO: UDEBUG_TS_BEGINNING |
|
- | 136 | if (ta->dt_state != UDEBUG_TS_ACTIVE) { |
|
- | 137 | spinlock_unlock(&ta->lock); |
|
- | 138 | interrupts_restore(ipl); |
|
- | 139 | klog_printf("udebug_rp_begin(): task not in TS_BEGINNING"); |
|
- | 140 | return EINVAL; |
|
- | 141 | } |
|
- | 142 | ||
- | 143 | /* Clear debug_active from all of the task's userspace threads */ |
|
- | 144 | ||
- | 145 | for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) { |
|
- | 146 | t = list_get_instance(cur, thread_t, th_link); |
|
- | 147 | ||
- | 148 | spinlock_lock(&t->lock); |
|
- | 149 | if ((t->flags & THREAD_FLAG_USPACE) != 0) |
|
- | 150 | t->debug_active = true; |
|
- | 151 | spinlock_unlock(&t->lock); |
|
- | 152 | } |
|
- | 153 | ||
- | 154 | /* Now respond to unanswered GO calls and reset thread states */ |
|
- | 155 | for (cur = ta->th_head.next; cur != &ta->th_head; cur = cur->next) { |
|
- | 156 | t = list_get_instance(cur, thread_t, th_link); |
|
- | 157 | ||
- | 158 | spinlock_lock(&t->lock); |
|
- | 159 | ||
- | 160 | /* Still has go? */ |
|
- | 161 | if ((t->flags & THREAD_FLAG_USPACE) != 0 && |
|
- | 162 | t->debug_stop == false) { |
|
- | 163 | /* |
|
- | 164 | * Yes, so clear go. As debug_active == false, |
|
- | 165 | * this doesn't affect anything. |
|
- | 166 | */ |
|
- | 167 | t->debug_stop = true; |
|
- | 168 | ||
- | 169 | /* Answer GO call */ |
|
- | 170 | ipc_answer(&ta->answerbox, t->debug_go_call); |
|
- | 171 | } else { |
|
- | 172 | /* |
|
- | 173 | * Debug_stop is already at initial value. |
|
- | 174 | * Yet this means the thread needs waking up. |
|
- | 175 | */ |
|
- | 176 | waitq_wakeup(&t->go_wq, WAKEUP_FIRST); |
|
- | 177 | } |
|
- | 178 | spinlock_unlock(&t->lock); |
|
- | 179 | } |
|
- | 180 | ||
- | 181 | ta->dt_state = UDEBUG_TS_INACTIVE; |
|
- | 182 | ||
- | 183 | spinlock_unlock(&ta->lock); |
|
- | 184 | interrupts_restore(ipl); |
|
- | 185 | ||
- | 186 | klog_printf("udebug_rp_end() done\n"); |
|
- | 187 | ||
- | 188 | return 1; |
|
- | 189 | } |
|
- | 190 | ||
- | 191 | ||
121 | static int udebug_rp_go(call_t *call, phone_t *phone) |
192 | static int udebug_rp_go(call_t *call, phone_t *phone) |
122 | { |
193 | { |
123 | thread_t *t; |
194 | thread_t *t; |
124 | task_t *ta; |
195 | task_t *ta; |
125 | ipl_t ipl; |
196 | ipl_t ipl; |
Line 471... | Line 542... | ||
471 | 542 | ||
472 | switch (IPC_GET_ARG1(call->data)) { |
543 | switch (IPC_GET_ARG1(call->data)) { |
473 | case UDEBUG_M_BEGIN: |
544 | case UDEBUG_M_BEGIN: |
474 | rc = udebug_rp_begin(call, phone); |
545 | rc = udebug_rp_begin(call, phone); |
475 | return rc; |
546 | return rc; |
- | 547 | case UDEBUG_M_END: |
|
- | 548 | rc = udebug_rp_end(call, phone); |
|
- | 549 | return rc; |
|
476 | case UDEBUG_M_GO: |
550 | case UDEBUG_M_GO: |
477 | rc = udebug_rp_go(call, phone); |
551 | rc = udebug_rp_go(call, phone); |
478 | return rc; |
552 | return rc; |
479 | case UDEBUG_M_ARGS_READ: |
553 | case UDEBUG_M_ARGS_READ: |
480 | rc = udebug_rp_args_read(call, phone); |
554 | rc = udebug_rp_args_read(call, phone); |