Changeset ff14c520 in mainline for generic/src


Ignore:
Timestamp:
2006-03-16T22:31:39Z (20 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
93165be
Parents:
37c57f2
Message:

It is now possible to associate symbolic names with both threads and tasks.
More verbose kconsole threads, tasks and scheduler commands.

Location:
generic/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • generic/src/main/kinit.c

    r37c57f2 rff14c520  
    8181                 * Just a beautification.
    8282                 */
    83                 if ((t = thread_create(kmp, NULL, TASK, 0))) {
     83                if ((t = thread_create(kmp, NULL, TASK, 0, "kmp"))) {
    8484                        spinlock_lock(&t->lock);
    8585                        t->flags |= X_WIRED;
     
    106106                for (i = 0; i < config.cpu_count; i++) {
    107107
    108                         if ((t = thread_create(kcpulb, NULL, TASK, 0))) {
     108                        if ((t = thread_create(kcpulb, NULL, TASK, 0, "kcpulb"))) {
    109109                                spinlock_lock(&t->lock);                       
    110110                                t->flags |= X_WIRED;
     
    127127         * Create kernel console.
    128128         */
    129         if ((t = thread_create(kconsole, "kconsole", TASK, 0)))
     129        if ((t = thread_create(kconsole, "kconsole", TASK, 0, "kconsole")))
    130130                thread_ready(t);
    131131        else
     
    143143                        panic("init[%d].addr is not frame aligned", i);
    144144
    145                 utask = task_run_program((void *) init.tasks[i].addr);
     145                utask = task_run_program((void *) init.tasks[i].addr, "USPACE");
    146146                if (utask) {
    147147                        if (!ipc_phone_0)
  • generic/src/main/main.c

    r37c57f2 rff14c520  
    197197         * Create kernel task.
    198198         */
    199         k = task_create(AS_KERNEL);
     199        k = task_create(AS_KERNEL, "KERNEL");
    200200        if (!k)
    201201                panic("can't create kernel task\n");
     
    204204         * Create the first thread.
    205205         */
    206         t = thread_create(kinit, NULL, k, 0);
     206        t = thread_create(kinit, NULL, k, 0, "kinit");
    207207        if (!t)
    208208                panic("can't create kinit thread\n");
  • generic/src/proc/scheduler.c

    r37c57f2 rff14c520  
    618618         * let's not be interrupted */
    619619        ipl = interrupts_disable();
    620         printf("Scheduler dump:\n");
    621620        for (cpu=0;cpu < config.cpu_count; cpu++) {
    622621
     
    625624
    626625                spinlock_lock(&cpus[cpu].lock);
    627                 printf("cpu%d: nrdy: %d, needs_relink: %d\n",
    628                        cpus[cpu].id, atomic_get(&cpus[cpu].nrdy), cpus[cpu].needs_relink);
     626                printf("cpu%d: address=%P, nrdy=%d, needs_relink=%d\n",
     627                       cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), cpus[cpu].needs_relink);
    629628               
    630629                for (i=0; i<RQ_COUNT; i++) {
  • generic/src/proc/task.c

    r37c57f2 rff14c520  
    6363 *
    6464 * @param as Task's address space.
     65 * @param name Symbolic name.
    6566 *
    6667 * @return New task's structure
    6768 *
    6869 */
    69 task_t *task_create(as_t *as)
     70task_t *task_create(as_t *as, char *name)
    7071{
    7172        ipl_t ipl;
     
    7980        list_initialize(&ta->tasks_link);
    8081        ta->as = as;
     82        ta->name = name;
    8183
    8284       
     
    102104/** Create new task with 1 thread and run it
    103105 *
     106 * @param programe_addr Address of program executable image.
     107 * @param name Program name.
     108 *
    104109 * @return Task of the running program or NULL on error
    105110 */
    106 task_t * task_run_program(void *program_addr)
     111task_t * task_run_program(void *program_addr, char *name)
    107112{
    108113        as_t *as;
     
    120125        }
    121126       
    122         task = task_create(as);
     127        task = task_create(as, name);
    123128        t = thread_create(uinit, (void *)((elf_header_t *)program_addr)->e_entry,
    124                           task, THREAD_USER_STACK);
     129                          task, 0, "uinit");
    125130       
    126131        /*
     
    149154                t = list_get_instance(cur, task_t, tasks_link);
    150155                spinlock_lock(&t->lock);
    151                 printf("Task: %Q ActiveCalls: %d", t->taskid,
    152                       atomic_get(&t->active_calls));
     156                printf("%s: address=%P, taskid=%Q, as=%P, ActiveCalls: %d",
     157                        t->name, t, t->taskid, t->as, atomic_get(&t->active_calls));
    153158                for (i=0; i < IPC_MAX_PHONES; i++) {
    154159                        if (t->phones[i].callee)
  • generic/src/proc/thread.c

    r37c57f2 rff14c520  
    249249 * @param task  Task to which the thread belongs.
    250250 * @param flags Thread flags.
     251 * @param name  Symbolic name.
    251252 *
    252253 * @return New thread's structure on success, NULL on failure.
    253254 *
    254255 */
    255 thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags)
     256thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name)
    256257{
    257258        thread_t *t;
     
    280281        interrupts_restore(ipl);
    281282       
     283        t->name = name;
    282284        t->thread_code = func;
    283285        t->thread_arg = arg;
     
    410412        for (cur=threads_head.next; cur!=&threads_head; cur=cur->next) {
    411413                t = list_get_instance(cur, thread_t, threads_link);
    412                 printf("Thr: %d(%s) ", t->tid, thread_states[t->state]);
     414                printf("%s: address=%P, tid=%d, state=%s, task=%P, code=%P, stack=%P, cpu=",
     415                        t->name, t, t->tid, thread_states[t->state], t->task, t->thread_code, t->kstack);
    413416                if (t->cpu)
    414417                        printf("cpu%d ", t->cpu->id);
     418                else
     419                        printf("none");
    415420                printf("\n");
    416421        }
Note: See TracChangeset for help on using the changeset viewer.