Changeset c98e6ee in mainline for kernel/generic/src/main/kinit.c


Ignore:
Timestamp:
2008-07-08T16:05:45Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f93f168
Parents:
b7f9087
Message:

Merge program-loader related stuff from dynload branch to trunk. (huge)

File:
1 edited

Legend:

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

    rb7f9087 rc98e6ee  
    4848#include <proc/task.h>
    4949#include <proc/thread.h>
     50#include <proc/program.h>
    5051#include <panic.h>
    5152#include <func.h>
     
    160161         */
    161162        count_t i;
    162         thread_t *threads[CONFIG_INIT_TASKS];
     163        program_t programs[CONFIG_INIT_TASKS];
    163164       
    164165        for (i = 0; i < init.cnt; i++) {
     
    168169                }
    169170
    170                 threads[i] = thread_create_program((void *) init.tasks[i].addr,
    171                     "uspace");
    172                
    173                 if (threads[i] != NULL) {
     171                int rc = program_create_from_image((void *) init.tasks[i].addr,
     172                    &programs[i]);
     173
     174                if (rc == 0 && programs[i].task != NULL) {
    174175                        /*
    175176                         * Set capabilities to init userspace tasks.
    176177                         */
    177                         cap_set(threads[i]->task, CAP_CAP | CAP_MEM_MANAGER |
     178                        cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
    178179                            CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG);
     180
    179181                       
    180182                        if (!ipc_phone_0)
    181                                 ipc_phone_0 = &threads[i]->task->answerbox;
     183                                ipc_phone_0 = &programs[i].task->answerbox;
     184                } else if (rc == 0) {
     185                        /* It was the program loader and was registered */
    182186                } else {
     187                        /* RAM disk image */
    183188                        int rd = init_rd((rd_header_t *) init.tasks[i].addr,
    184189                            init.tasks[i].size);
     
    194199         */
    195200        for (i = 0; i < init.cnt; i++) {
    196                 if (threads[i] != NULL) {
     201                if (programs[i].task != NULL) {
    197202                        thread_usleep(50000);
    198                         thread_ready(threads[i]);
     203                        program_ready(&programs[i]);
    199204                }
    200205        }
Note: See TracChangeset for help on using the changeset viewer.