This commit is contained in:
2026-10-11 17:43:21 +02:00
parent 85cf698aae
commit 41cc7fea77
15 changed files with 125 additions and 84 deletions
+8 -4
View File
@@ -25,6 +25,7 @@ static const char zinnia_banner[] = "Zinnia " ZINNIA_VERSION " " CONFIG_KERNEL_F
", " ZINNIA_COMPILER_ID ", " ZINNIA_LINKER_ID ")";
static void kernel_main_task(uintptr_t arg0) {
errno_t status = 0;
struct boot_info* info = (struct boot_info*)arg0;
log("main: Hello from main task!\n");
@@ -38,8 +39,12 @@ static void kernel_main_task(uintptr_t arg0) {
assert(vma_new(&init_space) == EOK, "");
struct boot_file* file_data = &info->files[0];
struct task* init_task = nullptr;
struct paged_vmo* init_file;
assert(vmo_new_phys(&init_file) == EOK, "");
status = vmo_new_phys(&init_file);
assert(status == EOK, "Failed to allocate a memory object");
vmo_write(&init_file->object, 0, HHDM_PTR(file_data->data), file_data->length, nullptr);
// Load init.
@@ -53,11 +58,10 @@ static void kernel_main_task(uintptr_t arg0) {
.envp = init_envp,
};
struct task* init_task = nullptr;
errno_t status = elf_load(&exec, &init_task);
status = elf_load(&exec, &init_task);
vmo_unref(&init_file->object);
assert(status == 0, "Failed to load init process (%i)\n", status);
assert(status == 0, "Failed to load init process (%i)", status);
sched_add_task(&percpu_get()->sched, init_task);
while (true) {