summaryrefslogtreecommitdiff
path: root/src/init
diff options
context:
space:
mode:
authordzwdz2021-07-23 14:08:44 +0200
committerdzwdz2021-07-23 14:08:44 +0200
commit67a359d8c4b9f5cb3d2e1fb9602ebe5dfd3978cf (patch)
tree0e09b36bc6240034fa20b630c5445a66eba4a54a /src/init
parent8a29c78d34f1924c4e39a3a951b36c4512ffe9c1 (diff)
add a barebones exit() syscall
Diffstat (limited to 'src/init')
-rw-r--r--src/init/main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 33a4372..84475da 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -4,6 +4,11 @@
int _syscall(int, int, int, int);
+void exit(const char *msg, size_t len) {
+ _syscall(SC_EXIT, (void*)msg, len, 0);
+ __builtin_unreachable();
+}
+
int debuglog(const char *msg, size_t len) {
return _syscall(SC_DEBUGLOG, (void*)msg, len, 0);
}
@@ -13,7 +18,6 @@ int main() {
debuglog("hello from init! ",
sizeof("hello from init! ") - 1);
- // try to mess with kernel memory
- uint8_t *kernel = (void*) 0x100000;
- *kernel = 0; // should segfault
+ exit( "bye from init! ",
+ sizeof("bye from init! ") - 1);
}