Subversion Repositories HelenOS

Rev

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

Rev 2913 Rev 2917
Line 39... Line 39...
39
#include <console/klog.h>
39
#include <console/klog.h>
40
#include <udebug/udebug.h>
40
#include <udebug/udebug.h>
41
#include <errno.h>
41
#include <errno.h>
42
#include <arch.h>
42
#include <arch.h>
43
 
43
 
-
 
44
static void udebug_wait_for_go(waitq_t *wq)
-
 
45
{
-
 
46
    int rc;
-
 
47
    ipl_t ipl;
-
 
48
 
-
 
49
    ipl = waitq_sleep_prepare(wq);
-
 
50
 
-
 
51
    wq->missed_wakeups = 0; /* Enforce blocking. */
-
 
52
    rc = waitq_sleep_timeout_unsafe(wq, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
-
 
53
 
-
 
54
    waitq_sleep_finish(wq, rc, ipl);
-
 
55
}
-
 
56
 
44
void udebug_stoppable_begin(void)
57
void udebug_stoppable_begin(void)
45
{
58
{
46
    int nsc;
59
    int nsc;
47
    call_t *db_call, *go_call;
60
    call_t *db_call, *go_call;
48
    ipl_t ipl;
61
    ipl_t ipl;
Line 156... Line 169...
156
        TASK->debug_begin_call = NULL;
169
        TASK->debug_begin_call = NULL;
157
        spinlock_unlock(&THREAD->debug_lock);
170
        spinlock_unlock(&THREAD->debug_lock);
158
        spinlock_unlock(&TASK->lock);
171
        spinlock_unlock(&TASK->lock);
159
        interrupts_restore(ipl);
172
        interrupts_restore(ipl);
160
 
173
 
161
        //klog_printf("udebug_stoppable_end: waitq_sleep");
-
 
162
        waitq_sleep(&THREAD->go_wq);
174
        udebug_wait_for_go(&THREAD->go_wq);
-
 
175
 
163
        goto restart;
176
        goto restart;
164
        /* must try again - have to lose stoppability atomically */
177
        /* must try again - have to lose stoppability atomically */
165
    } else {
178
    } else {
166
        ++TASK->not_stoppable_count;
179
        ++TASK->not_stoppable_count;
167
        THREAD->debug_stoppable = false;
180
        THREAD->debug_stoppable = false;
Line 220... Line 233...
220
    spinlock_unlock(&THREAD->debug_lock);
233
    spinlock_unlock(&THREAD->debug_lock);
221
 
234
 
222
    spinlock_lock(&TASK->lock);
235
    spinlock_lock(&TASK->lock);
223
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
236
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
224
    spinlock_unlock(&TASK->lock);
237
    spinlock_unlock(&TASK->lock);
225
 
-
 
226
    interrupts_restore(ipl);
238
    interrupts_restore(ipl);
227
 
239
 
228
    waitq_sleep(&THREAD->go_wq);
240
    udebug_wait_for_go(&THREAD->go_wq);
229
}
241
}
230
 
242
 
231
void udebug_thread_b_event(struct thread *t)
243
void udebug_thread_b_event(struct thread *t)
232
{
244
{
233
    call_t *call;
245
    call_t *call;
Line 270... Line 282...
270
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
282
    ipc_answer(&TASK->answerbox, THREAD->debug_go_call);
271
    spinlock_unlock(&TASK->lock);
283
    spinlock_unlock(&TASK->lock);
272
 
284
 
273
    interrupts_restore(ipl);
285
    interrupts_restore(ipl);
274
    klog_printf("- sleep");
286
    klog_printf("- sleep");
275
 
-
 
276
    waitq_sleep(&THREAD->go_wq);
287
    udebug_wait_for_go(&THREAD->go_wq);
277
}
288
}
278
 
289
 
279
void udebug_thread_e_event(void)
290
void udebug_thread_e_event(void)
280
{
291
{
281
    call_t *call;
292
    call_t *call;