28 lines
639 B
C
28 lines
639 B
C
|
#include "klibc.h"
|
||
|
#include "stdarg.h"
|
||
|
#include "syscall.h"
|
||
|
#include "thread.h"
|
||
|
|
||
|
int syscallExecute(int syscallId, const struct cpu_state *user_ctx){
|
||
|
|
||
|
int ret;
|
||
|
|
||
|
switch (syscallId) {
|
||
|
case SYSCALL_ID_EXIT:
|
||
|
uint status;
|
||
|
ret = syscallGet1arg(user_ctx, &status);
|
||
|
if(ret != 0)
|
||
|
break;
|
||
|
threadExit();
|
||
|
assert(0);
|
||
|
break;
|
||
|
case SYSCALL_ID_WRITE:
|
||
|
ret = printf("YOLO FROM USERSPACE\n");
|
||
|
break;
|
||
|
default:
|
||
|
printf("Unknon syscall id %d\n", syscallId);
|
||
|
ret = -ENOENT;
|
||
|
}
|
||
|
return ret;
|
||
|
}
|