summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 7040f6b..3cfc0ef 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -289,6 +289,14 @@ ret: // the macro is too stupid to handle returning pointers
return addr;
}
+void _syscall_debug_klog(const void __user *buf, size_t len) {
+ static char kbuf[256];
+ if (len >= sizeof(kbuf)) len = sizeof(kbuf) - 1;
+ virt_cpy_from(process_current->pages, kbuf, buf, len);
+ kbuf[len] = '\0';
+ kprintf("[klog] %x\t%s\n", process_current->id, kbuf);
+}
+
int _syscall(int num, int a, int b, int c, int d) {
switch (num) {
case _SYSCALL_EXIT:
@@ -324,6 +332,9 @@ int _syscall(int num, int a, int b, int c, int d) {
case _SYSCALL_MEMFLAG:
_syscall_memflag((userptr_t)a, b, c);
break;
+ case _SYSCALL_DEBUG_KLOG:
+ _syscall_debug_klog((userptr_t)a, b);
+ break;
default:
kprintf("unknown syscall ");
panic_unimplemented(); // TODO fail gracefully