diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 22:44:10 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-13 22:44:10 +0100 |
commit | 706c69d40fcc46e7d7f170dab932d3c7fcc7c34e (patch) | |
tree | 5248ff8712eced5bc4fdd76e9399654ce5224a37 /src/lib/libkogata/syscall.c | |
parent | 47e6cd42f0744f6c04b8347093f6549339a856c9 (diff) | |
download | kogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.tar.gz kogata-706c69d40fcc46e7d7f170dab932d3c7fcc7c34e.zip |
Begin implementation of syscalls.
Diffstat (limited to 'src/lib/libkogata/syscall.c')
-rw-r--r-- | src/lib/libkogata/syscall.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/libkogata/syscall.c b/src/lib/libkogata/syscall.c index 234b9ff..dc7e648 100644 --- a/src/lib/libkogata/syscall.c +++ b/src/lib/libkogata/syscall.c @@ -1,10 +1,21 @@ #include <debug.h> #include <syscall.h> +#include <string.h> + void dbg_print(const char* str) { - // TODO + + char buf[256]; + strncpy(buf, str, 256); + buf[255] = 0; + + asm volatile("int $0x40"::"a"(SC_DBG_PRINT),"b"(buf)); } void yield() { - // TODO + asm volatile("int $0x40"::"a"(SC_YIELD)); +} + +void exit(int code) { + asm volatile("int $0x40"::"a"(SC_EXIT),"b"(code)); } |