summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2025-02-02 22:33:13 +0000
committerAda Christine <adachristine18@gmail.com>2025-02-02 22:33:13 +0000
commit90c29fdde317c39384011a6ba97077c138f13ad6 (patch)
treea76eab90595198802925f8e3e2bd1ea4c87ca24f
parent6b9c30f9f35e9094762a96a861f0fa978c8e095d (diff)
no wait, cleanup
-rw-r--r--boot/config.h2
-rw-r--r--boot/main.c7
-rw-r--r--service/kjarna.c3
-rw-r--r--service/main.c1
4 files changed, 8 insertions, 5 deletions
diff --git a/boot/config.h b/boot/config.h
index c5769d8..b58bbd1 100644
--- a/boot/config.h
+++ b/boot/config.h
@@ -1,4 +1,4 @@
#pragma once
-#define DEBUG_WAIT
+//#define DEBUG_WAIT
diff --git a/boot/main.c b/boot/main.c
index 55eab00..d040e98 100644
--- a/boot/main.c
+++ b/boot/main.c
@@ -1,5 +1,7 @@
#include "kjarna.h"
#include "fake_syscall.h"
+#include <libc/stdio.h>
+#include <posix/sys/mman.h>
int main(int argc, char **argv)
{
@@ -7,6 +9,9 @@ int main(int argc, char **argv)
(void)argv;
struct kjarna_boot_image boot_image = get_boot_image();
- fake_syscall_start(&boot_image);
+ int result = fake_syscall_start(&boot_image);
+ printf("boot service exited with status %d\nhalting.\n", result);
+ munmap(boot_image.image_buffer.base, boot_image.image_buffer.length);
+ munmap(boot_image.stack_buffer.base, boot_image.stack_buffer.length);
}
diff --git a/service/kjarna.c b/service/kjarna.c
index 80adae0..b47a45c 100644
--- a/service/kjarna.c
+++ b/service/kjarna.c
@@ -10,8 +10,7 @@ int kjarna_entry()
uint64_t image_base;
__asm__ ("leaq kc_image_base(%%rip), %0" : "=r"(image_base) :: );
- bool wait = true;
-
+ bool wait = false;
while(wait);
int result = main(0, nullptr);
diff --git a/service/main.c b/service/main.c
index f00508f..e2c705b 100644
--- a/service/main.c
+++ b/service/main.c
@@ -19,7 +19,6 @@ static int open_kernel(void)
return -1;
}
- // crash here
if (!elf64_validate_fd(kernel_fd, ET_DYN, EM_X86_64))
{
printf("error: could not validate elf header\n");