Subversion Repositories HelenOS

Rev

Rev 2946 | Rev 3005 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2946 Rev 2947
1
/*
1
/*
2
 * Copyright (c) 2008 Jiri Svoboda
2
 * Copyright (c) 2008 Jiri Svoboda
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup debug
29
/** @addtogroup debug
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#include <stdio.h>
35
#include <stdio.h>
36
#include <stdlib.h>
36
#include <stdlib.h>
37
#include <unistd.h>
37
#include <unistd.h>
38
#include <syscall.h>
38
#include <syscall.h>
39
#include <ipc/ipc.h>
39
#include <ipc/ipc.h>
40
#include <fibril.h>
40
#include <fibril.h>
41
#include <errno.h>
41
#include <errno.h>
42
#include <udebug.h>
42
#include <udebug.h>
43
#include <async.h>
43
#include <async.h>
44
#include <string.h>
44
#include <string.h>
45
 
45
 
46
#include "cmd.h"
46
#include "cmd.h"
47
#include "cons.h"
47
#include "cons.h"
48
#include "dthread.h"
48
#include "dthread.h"
49
#include "include/arch.h"
49
#include "include/arch.h"
50
#include "fib_synch.h"
50
#include "fib_synch.h"
51
#include "main.h"
51
#include "main.h"
52
 
52
 
53
void thread_debug_start(unsigned thread_hash);
53
void thread_debug_start(unsigned thread_hash);
54
 
54
 
55
#define IN_BUF_SIZE 64
55
#define IN_BUF_SIZE 64
56
static char in_buf[IN_BUF_SIZE];
56
static char in_buf[IN_BUF_SIZE];
57
 
57
 
58
#define MAX_ARGC 10
58
#define MAX_ARGC 10
59
int cmd_argc;
59
int cmd_argc;
60
char *cmd_argv[MAX_ARGC + 1];   /* need one spare field for cmd_split() */
60
char *cmd_argv[MAX_ARGC + 1];   /* need one spare field for cmd_split() */
61
 
61
 
62
 
62
 
63
int next_thread_id;
63
int next_thread_id;
64
 
64
 
65
int app_phone;
65
int app_phone;
66
volatile bool abort_debug;
66
volatile bool abort_debug;
67
 
67
 
68
volatile int paused;
68
volatile int paused;
69
 
69
 
70
breakpoint_t brk_list[MAX_BRKPTS];
70
breakpoint_t brk_list[MAX_BRKPTS];
71
int lifted_brkpt;
71
int lifted_brkpt;
72
 
72
 
73
fcv_t go_cv;
73
fcv_t go_cv;
74
 
74
 
75
static void command_split(char *cmd_str)
75
static void command_split(char *cmd_str)
76
{
76
{
77
    char *p = cmd_str;
77
    char *p = cmd_str;
78
 
78
 
79
    if (*p == '\0') {
79
    if (*p == '\0') {
80
        cmd_argc = 0;
80
        cmd_argc = 0;
81
        return;
81
        return;
82
    }
82
    }
83
 
83
 
84
    cmd_argc = 1;
84
    cmd_argc = 1;
85
    cmd_argv[0] = p;
85
    cmd_argv[0] = p;
86
 
86
 
87
    while (*p != '\0') {
87
    while (*p != '\0') {
88
        if (*p == ' ') {
88
        if (*p == ' ') {
89
            cmd_argv[cmd_argc++] = p + 1;
89
            cmd_argv[cmd_argc++] = p + 1;
90
            *p = '\0';
90
            *p = '\0';
91
        }
91
        }
92
        ++p;
92
        ++p;
93
    }
93
    }
94
}
94
}
95
 
95
 
96
static void command_run(void)
96
static void command_run(void)
97
{
97
{
98
    int i;
98
    int i;
99
    int cmp_len;
99
    int cmp_len;
100
    int len;
100
    int len;
101
 
101
 
102
    int idx_found;
102
    int idx_found;
103
    int num_found;
103
    int num_found;
104
 
104
 
105
    len = strlen(cmd_argv[0]);
105
    len = strlen(cmd_argv[0]);
106
    cmp_len = 1;
106
    cmp_len = 1;
107
 
107
 
108
    /* Silence warnings */
108
    /* Silence warnings */
109
    num_found = 0;
109
    num_found = 0;
110
    idx_found = 0;
110
    idx_found = 0;
111
 
111
 
112
    while (cmp_len <= len + 1) {
112
    while (cmp_len <= len + 1) {
113
 
113
 
114
        num_found = 0;
114
        num_found = 0;
115
        i = 0;
115
        i = 0;
116
        while (cmd_table[i].name != NULL) {
116
        while (cmd_table[i].name != NULL) {
117
            if (strncmp(cmd_table[i].name, cmd_argv[0], cmp_len) == 0) {
117
            if (strncmp(cmd_table[i].name, cmd_argv[0], cmp_len) == 0) {
118
                idx_found = i;
118
                idx_found = i;
119
                ++num_found;
119
                ++num_found;
120
            }
120
            }
121
            ++i;
121
            ++i;
122
        }
122
        }
123
 
123
 
124
        if (num_found < 2) break;
124
        if (num_found < 2) break;
125
 
125
 
126
        --cmp_len;
126
        ++cmp_len;
127
    }
127
    }
128
 
128
 
129
    if (num_found == 0) {
129
    if (num_found == 0) {
130
        cons_printf("Unknown command. Try one of:\n");
130
        cons_printf("Unknown command. Try one of:\n");
131
        cmd_help(0, NULL);
131
        cmd_help(0, NULL);
132
        return;
132
        return;
133
    }
133
    }
134
 
134
 
135
    if (cmd_argc - 1 != cmd_table[idx_found].argc) {
135
    if (cmd_argc - 1 != cmd_table[idx_found].argc) {
136
        cons_printf("Command '%s' expects %d arguments\n",
136
        cons_printf("Command '%s' expects %d arguments\n",
137
        cmd_table[idx_found].name, cmd_table[idx_found].argc);
137
        cmd_table[idx_found].name, cmd_table[idx_found].argc);
138
        return;
138
        return;
139
    }
139
    }
140
 
140
 
141
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
141
    (*cmd_table[idx_found].proc)(cmd_argc, cmd_argv);
142
}
142
}
143
 
143
 
144
static void thread_stop(void)
144
static void thread_stop(void)
145
{
145
{
146
    dthread_t *dt;
146
    dthread_t *dt;
147
    uintptr_t pc;
147
    uintptr_t pc;
148
 
148
 
149
    dt = dthread_get();
149
    dt = dthread_get();
150
    pc = dthread_get_pc(dt);
150
    pc = dthread_get_pc(dt);
151
    cons_printf("[thread %d] stopped at 0x%lx\n", dt->id, pc);
151
    cons_printf("[thread %d] stopped at 0x%lx\n", dt->id, pc);
152
    dthread_stop_me();
152
    dthread_stop_me();
153
    cons_printf("[thread %d] go\n", dt->id);
153
    cons_printf("[thread %d] go\n", dt->id);
154
}
154
}
155
 
155
 
156
/*
156
/*
157
 * Called by a fibril (from arch code) when a breakpoint is hit.
157
 * Called by a fibril (from arch code) when a breakpoint is hit.
158
 */
158
 */
159
void breakpoint_hit(void)
159
void breakpoint_hit(void)
160
{
160
{
161
    cons_printf("breakpoint hit\n");
161
    cons_printf("breakpoint hit\n");
162
    thread_stop();
162
    thread_stop();
163
}
163
}
164
 
164
 
165
/*
165
/*
166
 * Called by a fibril (from arch code) when a single instruction
166
 * Called by a fibril (from arch code) when a single instruction
167
 * in singlestep is executed
167
 * in singlestep is executed
168
 */
168
 */
169
void singlestep_hit(void)
169
void singlestep_hit(void)
170
{
170
{
171
    cons_printf("singlestep hit\n");
171
    cons_printf("singlestep hit\n");
172
    thread_stop();
172
    thread_stop();
173
}
173
}
174
 
174
 
175
static int task_connect(int taskid)
175
static int task_connect(int taskid)
176
{
176
{
177
    int rc;
177
    int rc;
178
    unsigned evmask;
178
    unsigned evmask;
179
 
179
 
180
    cons_printf("ipc_connect_kbox(%d)... ", taskid);
180
    cons_printf("ipc_connect_kbox(%d)... ", taskid);
181
    rc = ipc_connect_kbox(taskid);
181
    rc = ipc_connect_kbox(taskid);
182
    cons_printf("-> %d\n", rc);
182
    cons_printf("-> %d\n", rc);
183
    app_phone = rc;
183
    app_phone = rc;
184
    if (rc < 0) return rc;
184
    if (rc < 0) return rc;
185
 
185
 
186
    cons_printf("udebug_begin()... ");
186
    cons_printf("udebug_begin()... ");
187
    rc = udebug_begin(app_phone);
187
    rc = udebug_begin(app_phone);
188
    cons_printf("-> %d\n", rc);
188
    cons_printf("-> %d\n", rc);
189
    if (rc < 0) return rc;
189
    if (rc < 0) return rc;
190
 
190
 
191
    evmask = UDEBUG_EM_ALL & ~(UDEBUG_EM_SYSCALL_B | UDEBUG_EM_SYSCALL_E);
191
    evmask = UDEBUG_EM_ALL & ~(UDEBUG_EM_SYSCALL_B | UDEBUG_EM_SYSCALL_E);
192
    cons_printf("udebug_set_evmask(0x%x)... ", evmask);
192
    cons_printf("udebug_set_evmask(0x%x)... ", evmask);
193
    rc = udebug_set_evmask(app_phone, evmask);
193
    rc = udebug_set_evmask(app_phone, evmask);
194
    cons_printf("-> %d\n", rc);
194
    cons_printf("-> %d\n", rc);
195
    if (rc < 0) return rc;
195
    if (rc < 0) return rc;
196
 
196
 
197
    return 0;
197
    return 0;
198
}
198
}
199
 
199
 
200
#define THASH_BUF_INIT_LENGTH 32
200
#define THASH_BUF_INIT_LENGTH 32
201
 
201
 
202
static int get_thread_list(thash_t **thash_buf_ptr, int *n)
202
static int get_thread_list(thash_t **thash_buf_ptr, int *n)
203
{
203
{
204
    int rc;
204
    int rc;
205
    size_t tb_copied;
205
    size_t tb_copied;
206
    size_t tb_needed;
206
    size_t tb_needed;
207
    int i;
207
    int i;
208
    size_t tb_size;
208
    size_t tb_size;
209
    thash_t *thash_buf;
209
    thash_t *thash_buf;
210
 
210
 
211
    tb_size = THASH_BUF_INIT_LENGTH * sizeof(thash_t);
211
    tb_size = THASH_BUF_INIT_LENGTH * sizeof(thash_t);
212
    thash_buf = malloc(tb_size);
212
    thash_buf = malloc(tb_size);
213
 
213
 
214
    rc = udebug_thread_read(app_phone, thash_buf,
214
    rc = udebug_thread_read(app_phone, thash_buf,
215
        tb_size, &tb_copied, &tb_needed);
215
        tb_size, &tb_copied, &tb_needed);
216
    if (rc < 0) return rc;
216
    if (rc < 0) return rc;
217
 
217
 
218
    if (tb_needed > tb_size) {
218
    if (tb_needed > tb_size) {
219
        /* Larger buffer needed  */
219
        /* Larger buffer needed  */
220
 
220
 
221
        free(thash_buf);
221
        free(thash_buf);
222
 
222
 
223
        tb_size = tb_needed;
223
        tb_size = tb_needed;
224
        thash_buf = malloc(tb_size);
224
        thash_buf = malloc(tb_size);
225
 
225
 
226
        if (!thash_buf) {
226
        if (!thash_buf) {
227
            printf("malloc failed\n");
227
            printf("malloc failed\n");
228
            exit(1);
228
            exit(1);
229
        }
229
        }
230
 
230
 
231
        /* Try again */
231
        /* Try again */
232
       
232
       
233
        rc = udebug_thread_read(app_phone, thash_buf,
233
        rc = udebug_thread_read(app_phone, thash_buf,
234
            tb_size, &tb_copied, &tb_needed);
234
            tb_size, &tb_copied, &tb_needed);
235
 
235
 
236
        if (rc < 0) return rc;
236
        if (rc < 0) return rc;
237
    }
237
    }
238
 
238
 
239
    *n = tb_copied / sizeof(thash_t);
239
    *n = tb_copied / sizeof(thash_t);
240
 
240
 
241
    cons_printf("thread hashes:");
241
    cons_printf("thread hashes:");
242
 
242
 
243
    for (i = 0; i < *n; ++i) {
243
    for (i = 0; i < *n; ++i) {
244
        cons_printf("0x%x\n", thash_buf[i]);
244
        cons_printf("0x%x\n", thash_buf[i]);
245
    }
245
    }
246
 
246
 
247
    cons_printf("Total of %u threads\n", *n);
247
    cons_printf("Total of %u threads\n", *n);
248
 
248
 
249
    *thash_buf_ptr = thash_buf;
249
    *thash_buf_ptr = thash_buf;
250
 
250
 
251
    return 0;
251
    return 0;
252
}
252
}
253
 
253
 
254
static void event_thread_b(unsigned hash)
254
static void event_thread_b(unsigned hash)
255
{
255
{
256
    async_serialize_start();
256
    async_serialize_start();
257
    cons_printf("new thread, hash 0x%x\n", hash);
257
    cons_printf("new thread, hash 0x%x\n", hash);
258
    async_serialize_end();
258
    async_serialize_end();
259
 
259
 
260
    thread_debug_start(hash);
260
    thread_debug_start(hash);
261
}
261
}
262
 
262
 
263
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
263
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
264
{
264
{
265
    switch (ev_type) {
265
    switch (ev_type) {
266
    case UDEBUG_EVENT_STOP:
266
    case UDEBUG_EVENT_STOP:
267
        cons_printf("stop event\n");
267
        cons_printf("stop event\n");
268
        thread_stop();
268
        thread_stop();
269
        break;
269
        break;
270
    case UDEBUG_EVENT_THREAD_B:
270
    case UDEBUG_EVENT_THREAD_B:
271
        event_thread_b(val0);
271
        event_thread_b(val0);
272
        break;
272
        break;
273
    case UDEBUG_EVENT_THREAD_E:
273
    case UDEBUG_EVENT_THREAD_E:
274
        cons_printf("thread 0x%x exited\n", val0);
274
        cons_printf("thread 0x%x exited\n", val0);
275
        abort_debug = true;
275
        abort_debug = true;
276
        break;
276
        break;
277
    case UDEBUG_EVENT_BREAKPOINT:
277
    case UDEBUG_EVENT_BREAKPOINT:
278
        arch_event_breakpoint(thash);
278
        arch_event_breakpoint(thash);
279
        break;
279
        break;
280
    case UDEBUG_EVENT_TRAP:
280
    case UDEBUG_EVENT_TRAP:
281
        arch_event_trap(dthread_get());
281
        arch_event_trap(dthread_get());
282
        break;
282
        break;
283
    default:
283
    default:
284
        cons_printf("unknown event type %d\n", ev_type);
284
        cons_printf("unknown event type %d\n", ev_type);
285
        break;
285
        break;
286
    }
286
    }
287
}
287
}
288
 
288
 
289
static int debug_loop(void *dt_arg)
289
static int debug_loop(void *dt_arg)
290
{
290
{
291
    int rc;
291
    int rc;
292
    udebug_event_t ev_type;
292
    udebug_event_t ev_type;
293
    unsigned val0, val1;
293
    unsigned val0, val1;
294
    dthread_t *dt;
294
    dthread_t *dt;
295
 
295
 
296
    dt = (dthread_t *)dt_arg;
296
    dt = (dthread_t *)dt_arg;
297
 
297
 
298
    cons_printf("debug_loop(%d)\n", dt->id);
298
    cons_printf("debug_loop(%d)\n", dt->id);
299
 
299
 
300
    while (!abort_debug) {
300
    while (!abort_debug) {
301
 
301
 
302
        /* Run thread until an event occurs */
302
        /* Run thread until an event occurs */
303
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
303
        rc = udebug_go(app_phone, dt->hash, &ev_type, &val0, &val1);
304
 
304
 
305
        if (ev_type == UDEBUG_EVENT_FINISHED) {
305
        if (ev_type == UDEBUG_EVENT_FINISHED) {
306
            cons_printf("thread %u debugging finished\n", dt->id);
306
            cons_printf("thread %u debugging finished\n", dt->id);
307
            break;
307
            break;
308
        }
308
        }
309
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
309
        if (rc >= 0) debug_event(dt->hash, ev_type, val0);
310
    }
310
    }
311
 
311
 
312
    cons_printf("debug_loop(%d) exiting\n", dt->id);
312
    cons_printf("debug_loop(%d) exiting\n", dt->id);
313
    return 0;
313
    return 0;
314
}
314
}
315
 
315
 
316
void thread_debug_start(unsigned thash)
316
void thread_debug_start(unsigned thash)
317
{
317
{
318
    fid_t fid;
318
    fid_t fid;
319
    dthread_t *dt;
319
    dthread_t *dt;
320
 
320
 
321
    dt = dthread_new(thash);
321
    dt = dthread_new(thash);
322
 
322
 
323
    fid = fibril_create(debug_loop, (void *)dt);
323
    fid = fibril_create(debug_loop, (void *)dt);
324
    if (fid == 0) {
324
    if (fid == 0) {
325
        cons_printf("Warning: Failed creating fibril\n");
325
        cons_printf("Warning: Failed creating fibril\n");
326
    }
326
    }
327
    dt->fid = fid;
327
    dt->fid = fid;
328
 
328
 
329
    fibril_add_ready(fid);
329
    fibril_add_ready(fid);
330
}
330
}
331
 
331
 
332
static void debug_active_task(void)
332
static void debug_active_task(void)
333
{
333
{
334
    int taskid;
334
    int taskid;
335
    int i;
335
    int i;
336
    int rc;
336
    int rc;
337
 
337
 
338
    thash_t *thash_buffer;
338
    thash_t *thash_buffer;
339
    int n_threads;
339
    int n_threads;
340
 
340
 
341
    cons_printf("Breakpoint Debugger\n");
341
    cons_printf("Breakpoint Debugger\n");
342
    cons_printf("Press 'c' to connect\n");
342
    cons_printf("Press 'c' to connect\n");
343
    while ((i = getchar()) != 'c')
343
    while ((i = getchar()) != 'c')
344
        putchar(i);
344
        putchar(i);
345
 
345
 
346
    taskid = 14;
346
    taskid = 14;
347
    rc = task_connect(taskid);
347
    rc = task_connect(taskid);
348
    if (rc < 0) {
348
    if (rc < 0) {
349
        cons_printf("Failed to connect to task %d\n", taskid);
349
        cons_printf("Failed to connect to task %d\n", taskid);
350
        return;
350
        return;
351
    }
351
    }
352
 
352
 
353
    cons_printf("Connected to task %d\n", taskid);
353
    cons_printf("Connected to task %d\n", taskid);
354
 
354
 
355
    rc = get_thread_list(&thash_buffer, &n_threads);
355
    rc = get_thread_list(&thash_buffer, &n_threads);
356
    if (rc < 0) {
356
    if (rc < 0) {
357
        cons_printf("Failed to get thread list\n", rc);
357
        cons_printf("Failed to get thread list\n", rc);
358
        return;
358
        return;
359
    }
359
    }
360
 
360
 
361
    abort_debug = false;
361
    abort_debug = false;
362
 
362
 
363
    for (i = 0; i < n_threads; i++) {
363
    for (i = 0; i < n_threads; i++) {
364
        thread_debug_start(thash_buffer[i]);
364
        thread_debug_start(thash_buffer[i]);
365
    }
365
    }
366
 
366
 
367
    while (!quit) {
367
    while (!quit) {
368
        cons_read_line(in_buf, IN_BUF_SIZE);
368
        cons_read_line(in_buf, IN_BUF_SIZE);
369
        command_split(in_buf);
369
        command_split(in_buf);
370
        if (cmd_argc == 0) continue;
370
        if (cmd_argc == 0) continue;
371
 
371
 
372
        command_run();
372
        command_run();
373
    }
373
    }
374
 
374
 
375
    cons_printf("terminate debugging session...\n");
375
    cons_printf("terminate debugging session...\n");
376
    abort_debug = true;
376
    abort_debug = true;
377
    udebug_end(app_phone);
377
    udebug_end(app_phone);
378
    ipc_hangup(app_phone);
378
    ipc_hangup(app_phone);
379
 
379
 
380
    cons_printf("done\n");
380
    cons_printf("done\n");
381
    return;
381
    return;
382
}
382
}
383
 
383
 
384
static void main_init(void)
384
static void main_init(void)
385
{
385
{
386
    next_thread_id = 1;
386
    next_thread_id = 1;
387
    paused = 0;
387
    paused = 0;
388
   
388
   
389
    list_initialize(&dthreads);
389
    list_initialize(&dthreads);
390
    cwt = NULL;
390
    cwt = NULL;
391
 
391
 
392
    fcv_init(&go_cv);
392
    fcv_init(&go_cv);
393
}
393
}
394
 
394
 
395
int main(void)
395
int main(void)
396
{
396
{
397
    main_init();
397
    main_init();
398
 
398
 
399
    while (1) {
399
    while (1) {
400
        debug_active_task();
400
        debug_active_task();
401
    }
401
    }
402
}
402
}
403
 
403
 
404
/** @}
404
/** @}
405
 */
405
 */
406
 
406