Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3424 → Rev 3425

/branches/tracing/kernel/generic/src/main/kinit.c
47,6 → 47,7
#include <proc/scheduler.h>
#include <proc/task.h>
#include <proc/thread.h>
#include <proc/program.h>
#include <panic.h>
#include <func.h>
#include <cpu.h>
146,7 → 147,8
/*
* Create kernel console.
*/
t = thread_create(kconsole, (void *) "kconsole", TASK, 0, "kconsole", false);
t = thread_create(kconsole, (void *) "kconsole", TASK, 0, "kconsole",
false);
if (t)
thread_ready(t);
else
158,7 → 160,7
* Create user tasks, load RAM disk images.
*/
count_t i;
thread_t *threads[CONFIG_INIT_TASKS];
program_t programs[CONFIG_INIT_TASKS];
for (i = 0; i < init.cnt; i++) {
if (init.tasks[i].addr % FRAME_SIZE) {
166,24 → 168,28
continue;
}
 
threads[i] = thread_create_program(
(void *) init.tasks[i].addr, "uspace");
if (threads[i] != NULL) {
int rc = program_create_from_image((void *) init.tasks[i].addr,
&programs[i]);
 
if (rc == 0 && programs[i].task != NULL) {
/*
* Set capabilities to init userspace tasks.
*/
cap_set(threads[i]->task, CAP_CAP | CAP_MEM_MANAGER |
cap_set(programs[i].task, CAP_CAP | CAP_MEM_MANAGER |
CAP_IO_MANAGER | CAP_PREEMPT_CONTROL | CAP_IRQ_REG);
if (!ipc_phone_0)
ipc_phone_0 = &threads[i]->task->answerbox;
ipc_phone_0 = &programs[i].task->answerbox;
} else if (rc == 0) {
/* It was the program loader and was registered */
} else {
/* RAM disk image */
int rd = init_rd((rd_header_t *) init.tasks[i].addr,
init.tasks[i].size);
if (rd != RE_OK)
printf("Init binary %" PRIc " not used, error code %d.\n", i, rd);
printf("Init binary %" PRIc " not used, error "
"code %d.\n", i, rd);
}
}
191,9 → 197,9
* Run user tasks with reasonable delays
*/
for (i = 0; i < init.cnt; i++) {
if (threads[i] != NULL) {
if (programs[i].task != NULL) {
thread_usleep(50000);
thread_ready(threads[i]);
program_ready(&programs[i]);
}
}
 
/branches/tracing/kernel/generic/src/main/main.c
61,6 → 61,7
#include <main/kinit.h>
#include <main/version.h>
#include <console/kconsole.h>
#include <console/console.h>
#include <cpu.h>
#include <align.h>
#include <interrupt.h>
80,8 → 81,8
#include <adt/btree.h>
#include <smp/smp.h>
#include <ddi/ddi.h>
#include <console/console.h>
 
 
/** Global configuration structure. */
config_t config;
 
235,8 → 236,8
/* Slab must be initialized after we know the number of processors. */
LOG_EXEC(slab_enable_cpucache());
printf("Detected %" PRIc " CPU(s), %" PRIu64" MB free memory\n",
config.cpu_count, SIZE2MB(zone_total_size()));
printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n",
config.cpu_count, SIZE2MB(zone_total_size()));
LOG_EXEC(cpu_init());
252,8 → 253,8
count_t i;
for (i = 0; i < init.cnt; i++)
printf("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc
"].size=%#" PRIs "\n", i, init.tasks[i].addr,
i, init.tasks[i].size);
"].size=%#" PRIs "\n", i, init.tasks[i].addr, i,
init.tasks[i].size);
} else
printf("No init binaries found\n");