source: mainline/kernel/generic/src/proc/task.c@ 5d3ed34

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5d3ed34 was 86939b1, checked in by Jakub Jermar <jakub@…>, 14 years ago

Maintain task's active calls in the active call list.

  • The call is placed on the list when sent and removed when the answer is picked up by the task.
  • Property mode set to 100644
File size: 14.9 KB
RevLine 
[f761f1eb]1/*
[278b4a30]2 * Copyright (c) 2010 Jakub Jermar
[f761f1eb]3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
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
15 * derived from this software without specific prior written permission.
16 *
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
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
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
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
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
[cc73a8a1]29/** @addtogroup genericproc
[b45c443]30 * @{
31 */
32
[9179d0a]33/**
[b45c443]34 * @file
[5ba201d]35 * @brief Task management.
[9179d0a]36 */
37
[f761f1eb]38#include <proc/thread.h>
39#include <proc/task.h>
[20d50a1]40#include <mm/as.h>
[085d973]41#include <mm/slab.h>
[31d8e10]42#include <atomic.h>
[f761f1eb]43#include <synch/spinlock.h>
[5573942]44#include <synch/waitq.h>
[f761f1eb]45#include <arch.h>
[8605b24]46#include <arch/barrier.h>
[b76a2217]47#include <adt/avl.h>
[7f6e755]48#include <adt/btree.h>
[5c9a08b]49#include <adt/list.h>
[6d9c49a]50#include <ipc/ipc.h>
[c98e6ee]51#include <ipc/ipcrsc.h>
[5d0500c]52#include <ipc/event.h>
[37c57f2]53#include <print.h>
[7509ddc]54#include <errno.h>
[95155b0c]55#include <func.h>
[19f857a]56#include <str.h>
[41df2827]57#include <memstr.h>
[e3c762cd]58#include <syscall/copy.h>
[95ad426]59#include <macros.h>
[8e5e78f]60
[b76a2217]61/** Spinlock protecting the tasks_tree AVL tree. */
[da1bafb]62IRQ_SPINLOCK_INITIALIZE(tasks_lock);
[88169d9]63
[b76a2217]64/** AVL tree of active tasks.
[88169d9]65 *
[b76a2217]66 * The task is guaranteed to exist after it was found in the tasks_tree as
[6f4495f5]67 * long as:
[5ba201d]68 *
[88169d9]69 * @li the tasks_lock is held,
[6f4495f5]70 * @li the task's lock is held when task's lock is acquired before releasing
71 * tasks_lock or
[7bb6b06]72 * @li the task's refcount is greater than 0
[88169d9]73 *
74 */
[b76a2217]75avltree_t tasks_tree;
[88169d9]76
[286e03d]77static task_id_t task_counter = 0;
[70527f1]78
[103de761]79static slab_cache_t *task_slab;
80
[121966e]81/* Forward declarations. */
82static void task_kill_internal(task_t *);
[da1bafb]83static int tsk_constructor(void *, unsigned int);
[121966e]84
[da1bafb]85/** Initialize kernel tasks support.
86 *
87 */
[f761f1eb]88void task_init(void)
89{
[43114c5]90 TASK = NULL;
[b76a2217]91 avltree_create(&tasks_tree);
[f97f1e51]92 task_slab = slab_cache_create("task_t", sizeof(task_t), 0,
[59ee56f]93 tsk_constructor, NULL, 0);
[b76a2217]94}
95
[da1bafb]96/** Task finish walker.
97 *
[121966e]98 * The idea behind this walker is to kill and count all tasks different from
[814c4f5]99 * TASK.
[da1bafb]100 *
[b76a2217]101 */
102static bool task_done_walker(avltree_node_t *node, void *arg)
103{
[da1bafb]104 task_t *task = avltree_get_instance(node, task_t, tasks_tree_node);
105 size_t *cnt = (size_t *) arg;
[5ba201d]106
[da1bafb]107 if (task != TASK) {
[121966e]108 (*cnt)++;
[da1bafb]109
[121966e]110#ifdef CONFIG_DEBUG
[da1bafb]111 printf("[%"PRIu64"] ", task->taskid);
[121966e]112#endif
[da1bafb]113
114 task_kill_internal(task);
[b76a2217]115 }
[5ba201d]116
117 /* Continue the walk */
118 return true;
[f761f1eb]119}
120
[da1bafb]121/** Kill all tasks except the current task.
122 *
123 */
[f74bbaf]124void task_done(void)
125{
[da1bafb]126 size_t tasks_left;
[5ba201d]127
[da1bafb]128 /* Repeat until there are any tasks except TASK */
129 do {
[121966e]130#ifdef CONFIG_DEBUG
131 printf("Killing tasks... ");
132#endif
[da1bafb]133
134 irq_spinlock_lock(&tasks_lock, true);
[121966e]135 tasks_left = 0;
136 avltree_walk(&tasks_tree, task_done_walker, &tasks_left);
[da1bafb]137 irq_spinlock_unlock(&tasks_lock, true);
138
[121966e]139 thread_sleep(1);
[da1bafb]140
[f74bbaf]141#ifdef CONFIG_DEBUG
[121966e]142 printf("\n");
143#endif
[da1bafb]144 } while (tasks_left > 0);
[f74bbaf]145}
[70527f1]146
[da1bafb]147int tsk_constructor(void *obj, unsigned int kmflags)
[59ee56f]148{
[da1bafb]149 task_t *task = (task_t *) obj;
150
151 atomic_set(&task->refcount, 0);
152 atomic_set(&task->lifecount, 0);
[5ba201d]153
[da1bafb]154 irq_spinlock_initialize(&task->lock, "task_t_lock");
155 mutex_initialize(&task->futexes_lock, MUTEX_PASSIVE);
[5ba201d]156
[55b77d9]157 list_initialize(&task->threads);
[5ba201d]158
[da1bafb]159 ipc_answerbox_init(&task->answerbox, task);
[5ba201d]160
[da1bafb]161 size_t i;
[59ee56f]162 for (i = 0; i < IPC_MAX_PHONES; i++)
[da1bafb]163 ipc_phone_init(&task->phones[i]);
[86939b1]164
165 spinlock_initialize(&task->active_calls_lock, "active_calls_lock");
166 list_initialize(&task->active_calls);
[5ba201d]167
[59ee56f]168#ifdef CONFIG_UDEBUG
169 /* Init kbox stuff */
[da1bafb]170 task->kb.thread = NULL;
171 ipc_answerbox_init(&task->kb.box, task);
172 mutex_initialize(&task->kb.cleanup_lock, MUTEX_PASSIVE);
[59ee56f]173#endif
[5ba201d]174
[59ee56f]175 return 0;
176}
177
[814c4f5]178/** Create new task with no threads.
[70527f1]179 *
[5ba201d]180 * @param as Task's address space.
181 * @param name Symbolic name (a copy is made).
[70527f1]182 *
[5ba201d]183 * @return New task's structure.
[70527f1]184 *
185 */
[a000878c]186task_t *task_create(as_t *as, const char *name)
[f761f1eb]187{
[da1bafb]188 task_t *task = (task_t *) slab_alloc(task_slab, 0);
189 task_create_arch(task);
190
191 task->as = as;
192 str_cpy(task->name, TASK_NAME_BUFLEN, name);
193
[473d5d2]194 task->container = CONTAINER;
[da1bafb]195 task->capabilities = 0;
196 task->ucycles = 0;
197 task->kcycles = 0;
198
199 task->ipc_info.call_sent = 0;
[be06914]200 task->ipc_info.call_received = 0;
[da1bafb]201 task->ipc_info.answer_sent = 0;
[be06914]202 task->ipc_info.answer_received = 0;
203 task->ipc_info.irq_notif_received = 0;
[da1bafb]204 task->ipc_info.forwarded = 0;
[5d0500c]205
206 event_task_init(task);
[da1bafb]207
[9a1b20c]208#ifdef CONFIG_UDEBUG
209 /* Init debugging stuff */
[da1bafb]210 udebug_task_init(&task->udebug);
[5ba201d]211
[9a1b20c]212 /* Init kbox stuff */
[da1bafb]213 task->kb.finished = false;
[9a1b20c]214#endif
[5ba201d]215
[59ee56f]216 if ((ipc_phone_0) &&
[473d5d2]217 (container_check(ipc_phone_0->task->container, task->container)))
[da1bafb]218 ipc_phone_connect(&task->phones[0], ipc_phone_0);
[5ba201d]219
[da1bafb]220 btree_create(&task->futexes);
[bb68433]221
[6193351]222 /*
223 * Get a reference to the address space.
224 */
[da1bafb]225 as_hold(task->as);
226
227 irq_spinlock_lock(&tasks_lock, true);
228
229 task->taskid = ++task_counter;
230 avltree_node_initialize(&task->tasks_tree_node);
231 task->tasks_tree_node.key = task->taskid;
232 avltree_insert(&tasks_tree, &task->tasks_tree_node);
233
234 irq_spinlock_unlock(&tasks_lock, true);
235
236 return task;
[f761f1eb]237}
238
[7509ddc]239/** Destroy task.
240 *
[da1bafb]241 * @param task Task to be destroyed.
[5ba201d]242 *
[7509ddc]243 */
[da1bafb]244void task_destroy(task_t *task)
[7509ddc]245{
[ea7890e7]246 /*
247 * Remove the task from the task B+tree.
248 */
[da1bafb]249 irq_spinlock_lock(&tasks_lock, true);
250 avltree_delete(&tasks_tree, &task->tasks_tree_node);
251 irq_spinlock_unlock(&tasks_lock, true);
[5ba201d]252
[ea7890e7]253 /*
254 * Perform architecture specific task destruction.
255 */
[da1bafb]256 task_destroy_arch(task);
[5ba201d]257
[ea7890e7]258 /*
259 * Free up dynamically allocated state.
260 */
[da1bafb]261 btree_destroy(&task->futexes);
[5ba201d]262
[ea7890e7]263 /*
264 * Drop our reference to the address space.
265 */
[da1bafb]266 as_release(task->as);
[31e8ddd]267
[da1bafb]268 slab_free(task_slab, task);
[7509ddc]269}
270
[278b4a30]271/** Hold a reference to a task.
272 *
273 * Holding a reference to a task prevents destruction of that task.
274 *
[da1bafb]275 * @param task Task to be held.
276 *
[278b4a30]277 */
[da1bafb]278void task_hold(task_t *task)
[278b4a30]279{
[da1bafb]280 atomic_inc(&task->refcount);
[278b4a30]281}
282
283/** Release a reference to a task.
284 *
285 * The last one to release a reference to a task destroys the task.
286 *
[da1bafb]287 * @param task Task to be released.
288 *
[278b4a30]289 */
[da1bafb]290void task_release(task_t *task)
[278b4a30]291{
[da1bafb]292 if ((atomic_predec(&task->refcount)) == 0)
293 task_destroy(task);
[278b4a30]294}
295
[dd8d5a7]296#ifdef __32_BITS__
297
298/** Syscall for reading task ID from userspace (32 bits)
[ec55358]299 *
[dd8d5a7]300 * @param uspace_taskid Pointer to user-space buffer
301 * where to store current task ID.
[5ba201d]302 *
303 * @return Zero on success or an error code from @ref errno.h.
[ec55358]304 *
305 */
[dd8d5a7]306sysarg_t sys_task_get_id(sysarg64_t *uspace_taskid)
[ec55358]307{
308 /*
[814c4f5]309 * No need to acquire lock on TASK because taskid remains constant for
310 * the lifespan of the task.
[ec55358]311 */
[dd8d5a7]312 return (sysarg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,
[6f4495f5]313 sizeof(TASK->taskid));
[ec55358]314}
315
[dd8d5a7]316#endif /* __32_BITS__ */
317
318#ifdef __64_BITS__
319
320/** Syscall for reading task ID from userspace (64 bits)
321 *
322 * @return Current task ID.
323 *
324 */
325sysarg_t sys_task_get_id(void)
326{
327 /*
328 * No need to acquire lock on TASK because taskid remains constant for
329 * the lifespan of the task.
330 */
331 return TASK->taskid;
332}
333
334#endif /* __64_BITS__ */
335
[bc18d63]336/** Syscall for setting the task name.
337 *
338 * The name simplifies identifying the task in the task list.
339 *
[5ba201d]340 * @param name The new name for the task. (typically the same
341 * as the command used to execute it).
[bc18d63]342 *
343 * @return 0 on success or an error code from @ref errno.h.
[5ba201d]344 *
[bc18d63]345 */
[96b02eb9]346sysarg_t sys_task_set_name(const char *uspace_name, size_t name_len)
[bc18d63]347{
348 char namebuf[TASK_NAME_BUFLEN];
[5ba201d]349
[bc18d63]350 /* Cap length of name and copy it from userspace. */
351 if (name_len > TASK_NAME_BUFLEN - 1)
352 name_len = TASK_NAME_BUFLEN - 1;
[5ba201d]353
[577f042a]354 int rc = copy_from_uspace(namebuf, uspace_name, name_len);
[bc18d63]355 if (rc != 0)
[96b02eb9]356 return (sysarg_t) rc;
[5ba201d]357
[f4b1535]358 namebuf[name_len] = '\0';
[577f042a]359
360 /*
361 * As the task name is referenced also from the
362 * threads, lock the threads' lock for the course
363 * of the update.
364 */
365
366 irq_spinlock_lock(&tasks_lock, true);
367 irq_spinlock_lock(&TASK->lock, false);
368 irq_spinlock_lock(&threads_lock, false);
369
370 /* Set task name */
[f4b1535]371 str_cpy(TASK->name, TASK_NAME_BUFLEN, namebuf);
[5ba201d]372
[577f042a]373 irq_spinlock_unlock(&threads_lock, false);
374 irq_spinlock_unlock(&TASK->lock, false);
375 irq_spinlock_unlock(&tasks_lock, true);
376
[bc18d63]377 return EOK;
378}
379
[1e9f8ab]380/** Syscall to forcefully terminate a task
381 *
382 * @param uspace_taskid Pointer to task ID in user space.
383 *
384 * @return 0 on success or an error code from @ref errno.h.
385 *
386 */
387sysarg_t sys_task_kill(task_id_t *uspace_taskid)
388{
389 task_id_t taskid;
[5bcf1f9]390 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));
[1e9f8ab]391 if (rc != 0)
392 return (sysarg_t) rc;
[5bcf1f9]393
[1e9f8ab]394 return (sysarg_t) task_kill(taskid);
395}
396
[9a8d91b]397/** Find task structure corresponding to task ID.
398 *
[814c4f5]399 * The tasks_lock must be already held by the caller of this function and
400 * interrupts must be disabled.
[9a8d91b]401 *
[5ba201d]402 * @param id Task ID.
403 *
[e1b6742]404 * @return Task structure address or NULL if there is no such task ID.
[9a8d91b]405 *
406 */
[5ba201d]407task_t *task_find_by_id(task_id_t id)
408{
[1d432f9]409 ASSERT(interrupts_disabled());
410 ASSERT(irq_spinlock_locked(&tasks_lock));
411
[e1b6742]412 avltree_node_t *node =
413 avltree_search(&tasks_tree, (avltree_key_t) id);
[5ba201d]414
[b76a2217]415 if (node)
[da1bafb]416 return avltree_get_instance(node, task_t, tasks_tree_node);
[5ba201d]417
[b76a2217]418 return NULL;
[9a8d91b]419}
420
[0313ff0]421/** Get accounting data of given task.
422 *
[1d432f9]423 * Note that task lock of 'task' must be already held and interrupts must be
[814c4f5]424 * already disabled.
[0313ff0]425 *
[da1bafb]426 * @param task Pointer to the task.
[88dea9d]427 * @param ucycles Out pointer to sum of all user cycles.
428 * @param kcycles Out pointer to sum of all kernel cycles.
[0313ff0]429 *
430 */
[da1bafb]431void task_get_accounting(task_t *task, uint64_t *ucycles, uint64_t *kcycles)
[0313ff0]432{
[1d432f9]433 ASSERT(interrupts_disabled());
434 ASSERT(irq_spinlock_locked(&task->lock));
435
[a2a00e8]436 /* Accumulated values of task */
[da1bafb]437 uint64_t uret = task->ucycles;
438 uint64_t kret = task->kcycles;
[0313ff0]439
440 /* Current values of threads */
[55b77d9]441 list_foreach(task->threads, cur) {
[da1bafb]442 thread_t *thread = list_get_instance(cur, thread_t, th_link);
443
444 irq_spinlock_lock(&thread->lock, false);
[0313ff0]445
[62b6d17]446 /* Process only counted threads */
[da1bafb]447 if (!thread->uncounted) {
448 if (thread == THREAD) {
[6f4495f5]449 /* Update accounting of current thread */
[a2a00e8]450 thread_update_accounting(false);
[da1bafb]451 }
452
453 uret += thread->ucycles;
454 kret += thread->kcycles;
[62b6d17]455 }
[da1bafb]456
457 irq_spinlock_unlock(&thread->lock, false);
[0313ff0]458 }
459
[a2a00e8]460 *ucycles = uret;
461 *kcycles = kret;
[0313ff0]462}
463
[da1bafb]464static void task_kill_internal(task_t *task)
[121966e]465{
[df58e44]466 irq_spinlock_lock(&task->lock, false);
467 irq_spinlock_lock(&threads_lock, false);
[5ba201d]468
[121966e]469 /*
470 * Interrupt all threads.
471 */
[df58e44]472
[55b77d9]473 list_foreach(task->threads, cur) {
[da1bafb]474 thread_t *thread = list_get_instance(cur, thread_t, th_link);
[121966e]475 bool sleeping = false;
476
[da1bafb]477 irq_spinlock_lock(&thread->lock, false);
[121966e]478
[da1bafb]479 thread->interrupted = true;
480 if (thread->state == Sleeping)
[121966e]481 sleeping = true;
[da1bafb]482
483 irq_spinlock_unlock(&thread->lock, false);
[121966e]484
485 if (sleeping)
[da1bafb]486 waitq_interrupt_sleep(thread);
[121966e]487 }
[da1bafb]488
[df58e44]489 irq_spinlock_unlock(&threads_lock, false);
[da1bafb]490 irq_spinlock_unlock(&task->lock, false);
[121966e]491}
492
[7509ddc]493/** Kill task.
[ea7890e7]494 *
495 * This function is idempotent.
496 * It signals all the task's threads to bail it out.
[7509ddc]497 *
[5ba201d]498 * @param id ID of the task to be killed.
499 *
500 * @return Zero on success or an error code from errno.h.
[7509ddc]501 *
502 */
503int task_kill(task_id_t id)
504{
[9b6aae6]505 if (id == 1)
506 return EPERM;
[7509ddc]507
[da1bafb]508 irq_spinlock_lock(&tasks_lock, true);
509
510 task_t *task = task_find_by_id(id);
511 if (!task) {
512 irq_spinlock_unlock(&tasks_lock, true);
[7509ddc]513 return ENOENT;
514 }
[da1bafb]515
516 task_kill_internal(task);
517 irq_spinlock_unlock(&tasks_lock, true);
518
519 return EOK;
[7509ddc]520}
521
[5bcf1f9]522/** Kill the currently running task.
523 *
524 * @param notify Send out fault notifications.
525 *
526 * @return Zero on success or an error code from errno.h.
527 *
528 */
529void task_kill_self(bool notify)
530{
531 /*
532 * User space can subscribe for FAULT events to take action
533 * whenever a task faults (to take a dump, run a debugger, etc.).
534 * The notification is always available, but unless udebug is enabled,
535 * that's all you get.
536 */
537 if (notify) {
[f9061b4]538 /* Notify the subscriber that a fault occurred. */
539 if (event_notify_3(EVENT_FAULT, false, LOWER32(TASK->taskid),
540 UPPER32(TASK->taskid), (sysarg_t) THREAD) == EOK) {
[5bcf1f9]541#ifdef CONFIG_UDEBUG
542 /* Wait for a debugging session. */
543 udebug_thread_fault();
544#endif
545 }
546 }
547
548 irq_spinlock_lock(&tasks_lock, true);
549 task_kill_internal(TASK);
550 irq_spinlock_unlock(&tasks_lock, true);
551
552 thread_exit();
553}
554
555/** Process syscall to terminate the current task.
556 *
557 * @param notify Send out fault notifications.
558 *
559 */
560sysarg_t sys_task_exit(sysarg_t notify)
561{
562 task_kill_self(notify);
563
564 /* Unreachable */
565 return EOK;
566}
567
[b76a2217]568static bool task_print_walker(avltree_node_t *node, void *arg)
569{
[c0f13d2]570 bool *additional = (bool *) arg;
[da1bafb]571 task_t *task = avltree_get_instance(node, task_t, tasks_tree_node);
572 irq_spinlock_lock(&task->lock, false);
[5ba201d]573
[a2a00e8]574 uint64_t ucycles;
575 uint64_t kcycles;
[1ba37fa]576 char usuffix, ksuffix;
[da1bafb]577 task_get_accounting(task, &ucycles, &kcycles);
[e535eeb]578 order_suffix(ucycles, &ucycles, &usuffix);
579 order_suffix(kcycles, &kcycles, &ksuffix);
[88dea9d]580
[da1bafb]581#ifdef __32_BITS__
[c0f13d2]582 if (*additional)
[97d17fe]583 printf("%-8" PRIu64 " %9" PRIua, task->taskid,
584 atomic_get(&task->refcount));
[c0f13d2]585 else
586 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %10p %10p"
587 " %9" PRIu64 "%c %9" PRIu64 "%c\n", task->taskid,
[473d5d2]588 task->name, task->container, task, task->as,
[c0f13d2]589 ucycles, usuffix, kcycles, ksuffix);
[52755f1]590#endif
[5ba201d]591
[52755f1]592#ifdef __64_BITS__
[c0f13d2]593 if (*additional)
[7e752b2]594 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
[97d17fe]595 "%9" PRIua, task->taskid, ucycles, usuffix, kcycles,
596 ksuffix, atomic_get(&task->refcount));
[c0f13d2]597 else
598 printf("%-8" PRIu64 " %-14s %-5" PRIu32 " %18p %18p\n",
[473d5d2]599 task->taskid, task->name, task->container, task, task->as);
[52755f1]600#endif
[5ba201d]601
[c0f13d2]602 if (*additional) {
603 size_t i;
604 for (i = 0; i < IPC_MAX_PHONES; i++) {
605 if (task->phones[i].callee)
[7e752b2]606 printf(" %zu:%p", i, task->phones[i].callee);
[c0f13d2]607 }
608 printf("\n");
[b76a2217]609 }
[5ba201d]610
[da1bafb]611 irq_spinlock_unlock(&task->lock, false);
[b76a2217]612 return true;
613}
614
[c0f13d2]615/** Print task list
616 *
617 * @param additional Print additional information.
618 *
619 */
620void task_print_list(bool additional)
[37c57f2]621{
[f74bbaf]622 /* Messing with task structures, avoid deadlock */
[da1bafb]623 irq_spinlock_lock(&tasks_lock, true);
[5ba201d]624
625#ifdef __32_BITS__
[c0f13d2]626 if (additional)
[48dcc69]627 printf("[id ] [threads] [calls] [callee\n");
[c0f13d2]628 else
[473d5d2]629 printf("[id ] [name ] [ctn] [address ] [as ]"
[c0f13d2]630 " [ucycles ] [kcycles ]\n");
[52755f1]631#endif
[5ba201d]632
[52755f1]633#ifdef __64_BITS__
[c0f13d2]634 if (additional)
[be06914]635 printf("[id ] [ucycles ] [kcycles ] [threads] [calls]"
[c0f13d2]636 " [callee\n");
637 else
[473d5d2]638 printf("[id ] [name ] [ctn] [address ]"
[c0f13d2]639 " [as ]\n");
[52755f1]640#endif
[5ba201d]641
[c0f13d2]642 avltree_walk(&tasks_tree, task_print_walker, &additional);
[5ba201d]643
[da1bafb]644 irq_spinlock_unlock(&tasks_lock, true);
[37c57f2]645}
[7509ddc]646
[cc73a8a1]647/** @}
[b45c443]648 */
Note: See TracBrowser for help on using the repository browser.