aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-03-08 14:48:55 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-03-08 14:48:55 +0100
commit0985c6237b8592652d57efee2a964c4bc91ee455 (patch)
tree1ac06e7c924f9d34d738e23694d4efbbe9725123 /src/lib
parentad63830f0d841c41291fc01aed6e54726bd0b93f (diff)
downloadkogata-0985c6237b8592652d57efee2a964c4bc91ee455.tar.gz
kogata-0985c6237b8592652d57efee2a964c4bc91ee455.zip
Implement missing syscalls.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/include/syscall.h10
-rw-r--r--src/lib/libkogata/syscall.c21
2 files changed, 29 insertions, 2 deletions
diff --git a/src/lib/include/syscall.h b/src/lib/include/syscall.h
index b94c7fd..7579be3 100644
--- a/src/lib/include/syscall.h
+++ b/src/lib/include/syscall.h
@@ -9,14 +9,16 @@
#include <fs.h>
#include <debug.h>
+#include <token.h>
-typedef int fd_t;
-typedef int pid_t;
+typedef void (*entry_t)(void*);
void dbg_print(const char* str);
void yield();
void exit(int code);
void usleep(int usecs);
+bool new_thread(entry_t entry, void* data);
+void exit_thread();
bool mmap(void* addr, size_t size, int mode);
bool mmap_file(fd_t file, size_t offset, void* addr, size_t size, int mode);
@@ -37,6 +39,10 @@ bool stat_open(fd_t file, stat_t *s);
int ioctl(fd_t file, int command, void* data);
int get_mode(fd_t file);
+fd_pair_t make_channel(bool blocking);
+bool gen_token(fd_t file, token_t *tok);
+fd_t use_token(token_t *tok);
+
bool make_fs(const char* name, const char* driver, fd_t source, const char* options);
bool fs_add_source(const char* fs, fd_t source, const char* options);
bool fs_subfs(const char* name, const char* orig_fs, const char* root, int ok_modes);
diff --git a/src/lib/libkogata/syscall.c b/src/lib/libkogata/syscall.c
index c79096e..7ae0283 100644
--- a/src/lib/libkogata/syscall.c
+++ b/src/lib/libkogata/syscall.c
@@ -39,6 +39,15 @@ void usleep(int usecs) {
call(SC_USLEEP, usecs, 0, 0, 0, 0);
}
+bool new_thread(entry_t entry, void* data) {
+ // TODO
+ return false;
+}
+
+void exit_thread() {
+ call(SC_EXIT_THREAD, 0, 0, 0, 0, 0);
+}
+
bool mmap(void* addr, size_t size, int mode) {
return call(SC_MMAP, (uint32_t)addr, size, mode, 0, 0);
}
@@ -90,6 +99,18 @@ int get_mode(fd_t file) {
return call(SC_GET_MODE, file, 0, 0, 0, 0);
}
+fd_pair_t make_channel(bool blocking) {
+ fd_pair_t ret;
+ call(SC_MK_CHANNEL, blocking, (uint32_t)&ret, 0, 0, 0);
+ return ret;
+}
+bool gen_token(fd_t file, token_t *tok) {
+ return call(SC_GEN_TOKEN, file, (uint32_t)tok, 0, 0, 0);
+}
+fd_t use_token(token_t *tok) {
+ return call(SC_USE_TOKEN, (uint32_t)tok, 0, 0, 0, 0);
+}
+
bool make_fs(const char* name, const char* driver, fd_t source, const char* options) {
volatile sc_make_fs_args_t args = {
.driver = driver,