diff options
author | dzwdz | 2021-07-23 14:08:44 +0200 |
---|---|---|
committer | dzwdz | 2021-07-23 14:08:44 +0200 |
commit | 67a359d8c4b9f5cb3d2e1fb9602ebe5dfd3978cf (patch) | |
tree | 0e09b36bc6240034fa20b630c5445a66eba4a54a /src/kernel | |
parent | 8a29c78d34f1924c4e39a3a951b36c4512ffe9c1 (diff) |
add a barebones exit() syscall
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/syscalls.c | 10 | ||||
-rw-r--r-- | src/kernel/syscalls.h | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 24706d3..1bc1a44 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -4,6 +4,13 @@ #include <kernel/syscalls.h> #include <stdint.h> +int sc_exit(const char *msg, size_t len) { + // the message is currently ignored + + log_const("last process returned. "); + panic(); +} + int sc_debuglog(const char *msg, size_t len) { struct pagedir *pages = process_current->pages; void *phys = pagedir_virt2phys(pages, msg, true, false); @@ -23,6 +30,9 @@ int syscall_handler(int num, int a, int b, int c, void *stack, void *eip) { process_current->eip = eip; switch (num) { + case SC_EXIT: + sc_exit((void*)a, b); + panic(); // sc_exit should never return case SC_DEBUGLOG: return sc_debuglog((void*)a, b); default: diff --git a/src/kernel/syscalls.h b/src/kernel/syscalls.h index 39db6a9..a249046 100644 --- a/src/kernel/syscalls.h +++ b/src/kernel/syscalls.h @@ -2,5 +2,7 @@ // not caring about stable syscall numbers just yet enum { + SC_EXIT, + SC_DEBUGLOG }; |