Rev 2071 | Rev 2089 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2071 | Rev 2087 | ||
---|---|---|---|
Line 558... | Line 558... | ||
558 | 558 | ||
559 | /* Messing with thread structures, avoid deadlock */ |
559 | /* Messing with thread structures, avoid deadlock */ |
560 | ipl = interrupts_disable(); |
560 | ipl = interrupts_disable(); |
561 | spinlock_lock(&threads_lock); |
561 | spinlock_lock(&threads_lock); |
562 | 562 | ||
563 | printf("tid name address state task ctx code stack cycles cpu kstack waitqueue\n"); |
563 | printf("tid name address state task ctx code " |
- | 564 | " stack cycles cpu kstack waitqueue\n"); |
|
564 | printf("------ ---------- ---------- -------- ---------- --- ---------- ---------- ---------- ---- ---------- ----------\n"); |
565 | printf("------ ---------- ---------- -------- ---------- --- --------" |
- | 566 | "-- ---------- ---------- ---- ---------- ----------\n"); |
|
565 | 567 | ||
- | 568 | for (cur = threads_btree.leaf_head.next; |
|
566 | for (cur = threads_btree.leaf_head.next; cur != &threads_btree.leaf_head; cur = cur->next) { |
569 | cur != &threads_btree.leaf_head; cur = cur->next) { |
567 | btree_node_t *node; |
570 | btree_node_t *node; |
568 | int i; |
571 | int i; |
569 | 572 | ||
570 | node = list_get_instance(cur, btree_node_t, leaf_link); |
573 | node = list_get_instance(cur, btree_node_t, leaf_link); |
571 | for (i = 0; i < node->keys; i++) { |
574 | for (i = 0; i < node->keys; i++) { |
Line 575... | Line 578... | ||
575 | 578 | ||
576 | uint64_t cycles; |
579 | uint64_t cycles; |
577 | char suffix; |
580 | char suffix; |
578 | order(t->cycles, &cycles, &suffix); |
581 | order(t->cycles, &cycles, &suffix); |
579 | 582 | ||
- | 583 | printf("%-6zd %-10s %#10zx %-8s %#10zx %-3ld %#10zx " |
|
- | 584 | "%#10zx %9llu%c ", t->tid, t->name, t, |
|
580 | printf("%-6zd %-10s %#10zx %-8s %#10zx %-3ld %#10zx %#10zx %9llu%c ", t->tid, t->name, t, thread_states[t->state], t->task, t->task->context, t->thread_code, t->kstack, cycles, suffix); |
585 | thread_states[t->state], t->task, t->task->context, |
- | 586 | t->thread_code, t->kstack, cycles, suffix); |
|
581 | 587 | ||
582 | if (t->cpu) |
588 | if (t->cpu) |
583 | printf("%-4zd", t->cpu->id); |
589 | printf("%-4zd", t->cpu->id); |
584 | else |
590 | else |
585 | printf("none"); |
591 | printf("none"); |
586 | 592 | ||
587 | if (t->state == Sleeping) |
593 | if (t->state == Sleeping) |
588 | printf(" %#10zx %#10zx", t->kstack, t->sleep_queue); |
594 | printf(" %#10zx %#10zx", t->kstack, |
- | 595 | t->sleep_queue); |
|
589 | 596 | ||
590 | printf("\n"); |
597 | printf("\n"); |
591 | } |
598 | } |
592 | } |
599 | } |
593 | 600 | ||
Line 606... | Line 613... | ||
606 | */ |
613 | */ |
607 | bool thread_exists(thread_t *t) |
614 | bool thread_exists(thread_t *t) |
608 | { |
615 | { |
609 | btree_node_t *leaf; |
616 | btree_node_t *leaf; |
610 | 617 | ||
611 | return btree_search(&threads_btree, (btree_key_t) ((uintptr_t) t), &leaf) != NULL; |
618 | return btree_search(&threads_btree, (btree_key_t) ((uintptr_t) t), |
- | 619 | &leaf) != NULL; |
|
612 | } |
620 | } |
613 | 621 | ||
614 | 622 | ||
615 | /** Update accounting of current thread. |
623 | /** Update accounting of current thread. |
616 | * |
624 | * |
Line 645... | Line 653... | ||
645 | if (rc != 0) { |
653 | if (rc != 0) { |
646 | free(kernel_uarg); |
654 | free(kernel_uarg); |
647 | return (unative_t) rc; |
655 | return (unative_t) rc; |
648 | } |
656 | } |
649 | 657 | ||
650 | if ((t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf, false))) { |
658 | t = thread_create(uinit, kernel_uarg, TASK, THREAD_FLAG_USPACE, namebuf, |
- | 659 | false); |
|
- | 660 | if (t) { |
|
651 | tid = t->tid; |
661 | tid = t->tid; |
652 | thread_ready(t); |
662 | thread_ready(t); |
653 | return (unative_t) tid; |
663 | return (unative_t) tid; |
654 | } else { |
664 | } else { |
655 | free(kernel_uarg); |
665 | free(kernel_uarg); |
Line 668... | Line 678... | ||
668 | return 0; |
678 | return 0; |
669 | } |
679 | } |
670 | 680 | ||
671 | /** @} |
681 | /** @} |
672 | */ |
682 | */ |
- | 683 |