32,7 → 32,7 |
|
/** |
* @file |
* @brief Main initialization kernel function for all processors. |
* @brief Main initialization kernel function for all processors. |
* |
* During kernel boot, all processors, after architecture dependent |
* initialization, start executing code found in this file. After |
81,8 → 81,9 |
#include <adt/btree.h> |
#include <smp/smp.h> |
#include <ddi/ddi.h> |
#include <main/main.h> |
#include <ipc/event.h> |
|
|
/** Global configuration structure. */ |
config_t config; |
|
105,18 → 106,15 |
* appropriate sizes and addresses. |
*/ |
|
/**< Virtual address of where the kernel is loaded. */ |
/** Virtual address of where the kernel is loaded. */ |
uintptr_t hardcoded_load_address = 0; |
/**< Size of the kernel code in bytes. */ |
/** Size of the kernel code in bytes. */ |
size_t hardcoded_ktext_size = 0; |
/**< Size of the kernel data in bytes. */ |
/** Size of the kernel data in bytes. */ |
size_t hardcoded_kdata_size = 0; |
/**< Lowest safe stack virtual address. */ |
/** Lowest safe stack virtual address. */ |
uintptr_t stack_safe = 0; |
|
void main_bsp(void); |
void main_ap(void); |
|
/* |
* These two functions prevent stack from underflowing during the |
* kernel boot phase when SP is set to the very top of the reserved |
191,8 → 189,6 |
{ |
/* Keep this the first thing. */ |
the_initialize(THE); |
|
LOG(); |
|
version_print(); |
|
201,7 → 197,7 |
config.base, config.kernel_size, config.stack_base, |
config.stack_size); |
|
|
#ifdef CONFIG_KCONSOLE |
/* |
* kconsole data structures must be initialized very early |
* because other subsystems will register their respective |
208,6 → 204,7 |
* commands. |
*/ |
LOG_EXEC(kconsole_init()); |
#endif |
|
/* |
* Exception handler initialization, before architecture |
214,7 → 211,7 |
* starts adding its own handlers |
*/ |
LOG_EXEC(exc_init()); |
|
|
/* |
* Memory management subsystems initialization. |
*/ |
252,7 → 249,7 |
if (init.cnt > 0) { |
count_t i; |
for (i = 0; i < init.cnt; i++) |
printf("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc |
LOG("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc |
"].size=%#" PRIs "\n", i, init.tasks[i].addr, i, |
init.tasks[i].size); |
} else |
259,22 → 256,23 |
printf("No init binaries found\n"); |
|
LOG_EXEC(ipc_init()); |
LOG_EXEC(event_init()); |
LOG_EXEC(klog_init()); |
|
|
/* |
* Create kernel task. |
*/ |
task_t *kernel = task_create(AS_KERNEL, "kernel"); |
if (!kernel) |
panic("Can't create kernel task\n"); |
panic("Cannot create kernel task."); |
|
/* |
* Create the first thread. |
*/ |
thread_t *kinit_thread = thread_create(kinit, NULL, kernel, 0, "kinit", |
true); |
thread_t *kinit_thread |
= thread_create(kinit, NULL, kernel, 0, "kinit", true); |
if (!kinit_thread) |
panic("Can't create kinit thread\n"); |
panic("Cannot create kinit thread."); |
LOG_EXEC(thread_ready(kinit_thread)); |
|
/* |