stuff2
This commit is contained in:
+8
-15
@@ -1,4 +1,3 @@
|
||||
#include <zinnia/ipc/init.h>
|
||||
#include <common/compiler.h>
|
||||
#include <kernel/alloc.h>
|
||||
#include <kernel/assert.h>
|
||||
@@ -62,22 +61,22 @@ static void kernel_main_task(uintptr_t arg0) {
|
||||
struct boot_info* info = (struct boot_info*)arg0;
|
||||
kprintf("%s\n", zinnia_banner); // Say hello!
|
||||
|
||||
ASSERT(info->num_files >= 1, "No init executable provided\n");
|
||||
assert(info->num_files >= 1, "No init executable provided\n");
|
||||
|
||||
struct channel* init_ep;
|
||||
struct channel* other_ep;
|
||||
ASSERT(channel_create(&init_ep, &other_ep) == ZN_OK, "Failed to create init channel\n");
|
||||
assert(channel_create(&init_ep, &other_ep) == ZN_OK, "Failed to create init channel\n");
|
||||
|
||||
struct vas* init_space;
|
||||
ASSERT(vma_new(&init_space) == ZN_OK, "");
|
||||
assert(vma_new(&init_space) == ZN_OK, "");
|
||||
|
||||
struct boot_file* file_data = &info->files[0];
|
||||
struct paged_vmo* init_file;
|
||||
ASSERT(vmo_new_phys(&init_file) == ZN_OK, "");
|
||||
assert(vmo_new_phys(&init_file) == ZN_OK, "");
|
||||
vmo_write(&init_file->object, 0, HHDM_PTR(file_data->data), file_data->length, nullptr);
|
||||
|
||||
struct namespace* ns;
|
||||
ASSERT(namespace_new(&ns) == ZN_OK, "");
|
||||
assert(namespace_new(&ns) == ZN_OK, "");
|
||||
|
||||
struct namespace_desc init_ch_desc = {
|
||||
.type = NAMESPACE_DESC_CHANNEL,
|
||||
@@ -91,7 +90,7 @@ static void kernel_main_task(uintptr_t arg0) {
|
||||
|
||||
struct task* init_task;
|
||||
zn_status_t status = load_server(&info->files[0], init_argv, init_envp, &init_ch_desc, &init_task);
|
||||
ASSERT(status == ZN_OK, "Failed to load init process (%i)\n", status);
|
||||
assert(status == ZN_OK, "Failed to load init process (%i)\n", status);
|
||||
sched_add_task(&percpu_get()->sched, init_task);
|
||||
|
||||
// Load other daemons.
|
||||
@@ -107,16 +106,10 @@ static void kernel_main_task(uintptr_t arg0) {
|
||||
|
||||
struct task* task;
|
||||
status = load_server(&info->files[i], argv, envp, &ch_desc, &task);
|
||||
ASSERT(status == ZN_OK, "Failed to load server \"%s\": (%i)\n", info->files[i].path, status);
|
||||
assert(status == ZN_OK, "Failed to load server \"%s\": (%i)\n", info->files[i].path, status);
|
||||
sched_add_task(&percpu_get()->sched, task);
|
||||
}
|
||||
|
||||
struct ipc_kernel_msg* msg = mem_alloc(0x40, 0);
|
||||
msg->id = IPC_MSG_BAR;
|
||||
memcpy(msg->data, "This message is from the kernel!", 33);
|
||||
|
||||
channel_write(other_ep, msg, 0x40, nullptr, 0);
|
||||
|
||||
while (true) {
|
||||
arch_irq_wait();
|
||||
}
|
||||
@@ -140,7 +133,7 @@ void kernel_main(struct boot_info* info) {
|
||||
irq_unlock();
|
||||
sched_yield(&percpu_get()->sched);
|
||||
|
||||
__unreachable();
|
||||
unreachable();
|
||||
}
|
||||
|
||||
[[__init]]
|
||||
|
||||
Reference in New Issue
Block a user