aboutsummaryrefslogtreecommitdiff
path: root/src/lib/libc/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/debug.c')
-rw-r--r--src/lib/libc/debug.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/lib/libc/debug.c b/src/lib/libc/debug.c
index dc04fd3..f862fe6 100644
--- a/src/lib/libc/debug.c
+++ b/src/lib/libc/debug.c
@@ -1,7 +1,9 @@
#include <stdbool.h>
+#include <stdlib.h>
-#include <kogata/debug.h>
#include <kogata/syscall.h>
+#include <kogata/debug.h>
+#include <kogata/printf.h>
void sys_panic(const char* msg, const char* file, int line) {
dbg_printf("PANIC in user process\n %s\n at %s:%d\n", msg, file, line);
@@ -15,4 +17,23 @@ void sys_panic_assert(const char* assert, const char* file, int line) {
while(true);
}
+void dbg_print(const char* s) {
+ sc_dbg_print(s);
+}
+
+void dbg_printf(const char* fmt, ...) {
+ va_list ap;
+ char buffer[256];
+
+ va_start(ap, fmt);
+ vsnprintf(buffer, 256, fmt, ap);
+ va_end(ap);
+
+ dbg_print(buffer);
+}
+
+void yield() {
+ sc_yield();
+}
+
/* vim: set ts=4 sw=4 tw=0 noet :*/