diff options
author | Alex Auvolat <alex@adnab.me> | 2016-07-16 15:59:46 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2016-07-16 15:59:46 +0200 |
commit | 3d6a857b9186ef6304ea6cf04627c2b787169f29 (patch) | |
tree | 756179ce1e1838f75c57e3efec2a570d72051594 /src/lib/libc/debug.c | |
parent | 59000174aa50ed6b2d24a71576d15e6a53c5be0c (diff) | |
download | kogata-3d6a857b9186ef6304ea6cf04627c2b787169f29.tar.gz kogata-3d6a857b9186ef6304ea6cf04627c2b787169f29.zip |
Make way for libc implementation
Diffstat (limited to 'src/lib/libc/debug.c')
-rw-r--r-- | src/lib/libc/debug.c | 23 |
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 :*/ |