diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-04 21:02:43 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-04 21:02:43 +0200 |
commit | 68940415ee0932a68e2c3fb4fe0dc8b711e67d7c (patch) | |
tree | 6b5aadd621bd4cd4a00850247d35757709d83893 /src/user | |
parent | a9bb8d1be024730fc4687aab78a8e5cb54b4f05e (diff) | |
download | TCE-68940415ee0932a68e2c3fb4fe0dc8b711e67d7c.tar.gz TCE-68940415ee0932a68e2c3fb4fe0dc8b711e67d7c.zip |
Preparations.
Diffstat (limited to 'src/user')
-rw-r--r-- | src/user/lib/include/tce/syscall.h | 1 | ||||
-rw-r--r-- | src/user/lib/tce/syscall.c | 22 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/user/lib/include/tce/syscall.h b/src/user/lib/include/tce/syscall.h index 7cb4381..7bcdd2b 100644 --- a/src/user/lib/include/tce/syscall.h +++ b/src/user/lib/include/tce/syscall.h @@ -2,6 +2,7 @@ #define DEF_SYSCALL_H #include <types.h> +#include <tce/syscalls.h> #define NEW_STACK_SIZE 0x8000 diff --git a/src/user/lib/tce/syscall.c b/src/user/lib/tce/syscall.c index f9243b0..d606491 100644 --- a/src/user/lib/tce/syscall.c +++ b/src/user/lib/tce/syscall.c @@ -9,23 +9,23 @@ static size_t call(size_t a, size_t b, size_t c, size_t d, size_t e, size_t f) { } void thread_exit() { - call(0, 0, 0, 0, 0, 0); + call(0, SC_THREAD_EXIT, 0, 0, 0, 0); } void schedule() { - call(1, 0, 0,0, 0, 0); + call(0, SC_SCHEDULE, 0, 0,0, 0); } void thread_sleep(int time) { - call(2, time, 0, 0, 0, 0); + call(0, SC_THREAD_SLEEP, time, 0, 0, 0); } void process_exit(int retval) { - call(3, retval, 0, 0, 0, 0); + call(0, SC_PROCESS_EXIT, retval, 0, 0, 0); } void printk(char* str) { - call(4, (unsigned)str, 0, 0, 0, 0); + call(0, SC_PRINTK, (unsigned)str, 0, 0, 0); } //THREAD CREATION @@ -44,28 +44,28 @@ void thread_start(void *data) { if (_stack_to_free != 0) free(_stack_to_free); _stack_to_free = tsd->stack; asm volatile("movl %0, (_stack_freeing_mutex); int $64;" :: - "a"(0), "r"(MUTEX_UNLOCKED)); + "a"(0), "b"(SC_THREAD_EXIT), "r"(MUTEX_UNLOCKED)); } void thread_new(void (*entry)(void*), void *data) { struct thread_start_data *tsd = malloc(sizeof(struct thread_start_data)); tsd->entry = entry; tsd->data = data; tsd->stack = malloc(NEW_STACK_SIZE); - call(5, (unsigned)thread_start, (unsigned)tsd, (unsigned)(tsd->stack + NEW_STACK_SIZE), 0, 0); + call(0, SC_THREAD_NEW, (unsigned)thread_start, (unsigned)tsd, (unsigned)(tsd->stack + NEW_STACK_SIZE), 0); } void irq_wait(int number) { - call(6, number, 0, 0, 0, 0); + call(0, SC_IRQ_WAIT, number, 0, 0, 0); } int proc_priv() { - return call(7, 0, 0, 0, 0, 0); + return call(0, SC_PROC_PRIV, 0, 0, 0, 0); } void* sbrk(size_t s) { - return (void*)call(8, s, 0, 0, 0, 0); + return (void*)call(0, SC_SBRK, s, 0, 0, 0); } void brk(void* ptr) { - return call (9, ptr, 0, 0, 0, 0); + return call (0, SC_BRK, ptr, 0, 0, 0); } |