From cbadacbb881200b601c7b53b29aa0c1b78747692 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Tue, 23 Mar 2010 16:34:36 +0100 Subject: More work on IPC --- src/library/gc/syscall.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/library/gc/syscall.c (limited to 'src/library/gc') diff --git a/src/library/gc/syscall.c b/src/library/gc/syscall.c new file mode 100644 index 0000000..e1ef3cd --- /dev/null +++ b/src/library/gc/syscall.c @@ -0,0 +1,47 @@ +#include + +static int call(unsigned a, unsigned b, unsigned c, unsigned d, unsigned e, unsigned f) { + unsigned ret; + asm volatile("int $64" : "=a"(ret) : "a"(a), "b"(b), "c"(c), "d"(d), "S"(e), "D"(f)); + return ret; +} + +void thread_exit() { + call(0, 0, 0, 0, 0, 0); +} + +void schedule() { + call(1, 0, 0,0, 0, 0); +} + +void thread_sleep(int time) { + call(2, time, 0, 0, 0, 0); +} + +void process_exit(int retval) { + call(3, retval, 0, 0, 0, 0); +} + +void printk(char* str) { + call(4, (unsigned)str, 0, 0, 0, 0); +} + +void thread_new(void (*entry)(void*), void *data) { + call(5, (unsigned)entry, (unsigned)data, 0, 0, 0); +} + +void irq_wait(int number) { + call(6, number, 0, 0, 0, 0); +} + +int proc_priv() { + return call(7, 0, 0, 0, 0, 0); +} + +int shm_create(size_t offset, size_t length) { + return call(8, offset, length, 0, 0, 0); +} + +int shm_delete(size_t offset) { + return call(9, offset, 0, 0, 0, 0); +} -- cgit v1.2.3