Subversion Repositories HelenOS

Rev

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

Rev 4153 Rev 4581
Line 82... Line 82...
82
    udebug_task_cleanup(TASK);
82
    udebug_task_cleanup(TASK);
83
    spinlock_unlock(&TASK->lock);
83
    spinlock_unlock(&TASK->lock);
84
    interrupts_restore(ipl);
84
    interrupts_restore(ipl);
85
   
85
   
86
    if (have_kb_thread) {
86
    if (have_kb_thread) {
87
        LOG("join kb.thread..\n");
87
        LOG("Join kb.thread.");
88
        thread_join(TASK->kb.thread);
88
        thread_join(TASK->kb.thread);
89
        thread_detach(TASK->kb.thread);
89
        thread_detach(TASK->kb.thread);
90
        LOG("join done\n");
90
        LOG("...join done.");
91
        TASK->kb.thread = NULL;
91
        TASK->kb.thread = NULL;
92
    }
92
    }
93
 
93
 
94
    /* Answer all messages in 'calls' and 'dispatched_calls' queues. */
94
    /* Answer all messages in 'calls' and 'dispatched_calls' queues. */
95
    spinlock_lock(&TASK->kb.box.lock);
95
    spinlock_lock(&TASK->kb.box.lock);
Line 106... Line 106...
106
 **/
106
 **/
107
static void kbox_proc_phone_hungup(call_t *call, bool *last)
107
static void kbox_proc_phone_hungup(call_t *call, bool *last)
108
{
108
{
109
    ipl_t ipl;
109
    ipl_t ipl;
110
 
110
 
111
    LOG("kbox_proc_phone_hungup()\n");
-
 
112
 
-
 
113
    /* Was it our debugger, who hung up? */
111
    /* Was it our debugger, who hung up? */
114
    if (call->sender == TASK->udebug.debugger) {
112
    if (call->sender == TASK->udebug.debugger) {
115
        /* Terminate debugging session (if any). */
113
        /* Terminate debugging session (if any). */
116
        LOG("kbox: terminate debug session\n");
114
        LOG("Terminate debugging session.");
117
        ipl = interrupts_disable();
115
        ipl = interrupts_disable();
118
        spinlock_lock(&TASK->lock);
116
        spinlock_lock(&TASK->lock);
119
        udebug_task_cleanup(TASK);
117
        udebug_task_cleanup(TASK);
120
        spinlock_unlock(&TASK->lock);
118
        spinlock_unlock(&TASK->lock);
121
        interrupts_restore(ipl);
119
        interrupts_restore(ipl);
122
    } else {
120
    } else {
123
        LOG("kbox: was not debugger\n");
121
        LOG("Was not debugger.");
124
    }
122
    }
125
 
123
 
126
    LOG("kbox: continue with hangup message\n");
124
    LOG("Continue with hangup message.");
127
    IPC_SET_RETVAL(call->data, 0);
125
    IPC_SET_RETVAL(call->data, 0);
128
    ipc_answer(&TASK->kb.box, call);
126
    ipc_answer(&TASK->kb.box, call);
129
 
127
 
130
    ipl = interrupts_disable();
128
    ipl = interrupts_disable();
131
    spinlock_lock(&TASK->lock);
129
    spinlock_lock(&TASK->lock);
Line 143... Line 141...
143
            thread_detach(TASK->kb.thread);
141
            thread_detach(TASK->kb.thread);
144
            TASK->kb.thread = NULL;
142
            TASK->kb.thread = NULL;
145
        }
143
        }
146
        mutex_unlock(&TASK->kb.cleanup_lock);
144
        mutex_unlock(&TASK->kb.cleanup_lock);
147
 
145
 
148
        LOG("phone list is empty\n");
146
        LOG("Phone list is empty.");
149
        *last = true;
147
        *last = true;
150
    } else {
148
    } else {
151
        *last = false;
149
        *last = false;
152
    }
150
    }
153
 
151
 
Line 167... Line 165...
167
{
165
{
168
    call_t *call;
166
    call_t *call;
169
    bool done;
167
    bool done;
170
 
168
 
171
    (void)arg;
169
    (void)arg;
172
    LOG("kbox_thread_proc()\n");
170
    LOG("Starting.");
173
    done = false;
171
    done = false;
174
 
172
 
175
    while (!done) {
173
    while (!done) {
176
        call = ipc_wait_for_call(&TASK->kb.box, SYNCH_NO_TIMEOUT,
174
        call = ipc_wait_for_call(&TASK->kb.box, SYNCH_NO_TIMEOUT,
177
            SYNCH_FLAGS_NONE);
175
            SYNCH_FLAGS_NONE);
Line 199... Line 197...
199
            /* Ignore */
197
            /* Ignore */
200
            break;
198
            break;
201
        }
199
        }
202
    }
200
    }
203
 
201
 
204
    LOG("kbox: finished\n");
202
    LOG("Exiting.");
205
}
203
}
206
 
204
 
207
 
205
 
208
/**
206
/**
209
 * Connect phone to a task kernel-box specified by id.
207
 * Connect phone to a task kernel-box specified by id.
Line 248... Line 246...
248
    if (ta->kb.finished != false) {
246
    if (ta->kb.finished != false) {
249
        mutex_unlock(&ta->kb.cleanup_lock);
247
        mutex_unlock(&ta->kb.cleanup_lock);
250
        return EINVAL;
248
        return EINVAL;
251
    }
249
    }
252
 
250
 
253
    newphid = phone_alloc();
251
    newphid = phone_alloc(TASK);
254
    if (newphid < 0) {
252
    if (newphid < 0) {
255
        mutex_unlock(&ta->kb.cleanup_lock);
253
        mutex_unlock(&ta->kb.cleanup_lock);
256
        return ELIMIT;
254
        return ELIMIT;
257
    }
255
    }
258
 
256