+SYSCALL2(Syscall_Open, "si", const char *, int,
+ return VFS_Open(a0, a1|VFS_OPENFLAG_USER);
+);
+SYSCALL1(Syscall_Close, "i", int,
+ VFS_Close(a0);
+ return 0;
+);
+SYSCALL3(Syscall_Read, "iid", int, int, void *,
+ if( Sizes[2] < a1 ) {
+ Log_Warning("Syscalls", "Read - %i < %i", Sizes[2], a1);
+ return -1;
+ }
+ return VFS_Read(a0, a1, a2);
+);
+SYSCALL3(Syscall_Write, "iid", int, int, const void *,
+ if( Sizes[2] < a1 )
+ return -1;
+ return VFS_Write(a0, a1, a2);
+);
+SYSCALL3(Syscall_Seek, "iIi", int, int64_t, int,
+ return VFS_Seek(a0, a1, a2);
+);
+SYSCALL1(Syscall_Tell, "i", int,
+ return VFS_Tell(a0);
+);
+SYSCALL3(Syscall_IOCtl, "iid", int, int, void *,
+ return VFS_IOCtl(a0, a1, a2);
+);
+SYSCALL3(Syscall_FInfo, "idi", int, void *, int,
+ if( Sizes[1] < sizeof(tFInfo)+a2*sizeof(tVFS_ACL)) {
+ LOG("offsetof(size) = %i", offsetof(tFInfo, size));
+ LOG("Bad size %i < %i", Sizes[1], sizeof(tFInfo)+a2*sizeof(tVFS_ACL));
+ *Errno = -EINVAL;
+ return -1;
+ }
+ return VFS_FInfo(a0, a1, a2);
+);
+SYSCALL2(Syscall_ReadDir, "id", int, char *,
+ if(Sizes[1] < 255)
+ return -1;
+ return VFS_ReadDir(a0, a1);
+);
+SYSCALL6(Syscall_select, "iddddi", int, fd_set *, fd_set *, fd_set *, tTime *, unsigned int,
+ return VFS_Select(a0, a1, a2, a3, a4, a5, 0);
+);
+SYSCALL3(Syscall_OpenChild, "isi", int, const char *, int,
+ return VFS_OpenChild(a0, a1, a2|VFS_OPENFLAG_USER);
+);
+SYSCALL2(Syscall_GetACL, "id", int, void *,
+ if(Sizes[1] < sizeof(tVFS_ACL))
+ return -1;
+ return VFS_GetACL(a0, (void*)a1);
+);
+SYSCALL4(Syscall_Mount, "ssss", const char *, const char *, const char *, const char *,
+ return VFS_Mount(a0, a1, a2, a3);
+);
+SYSCALL1(Syscall_Chdir, "s", const char *,
+ return VFS_ChDir(a0);
+);
+SYSCALL0(Syscall_Sleep,
+ Threads_Sleep();
+ return 0;
+);
+SYSCALL2(Syscall_WaitTID, "id", int, int *,
+ if(Sizes[1] < sizeof(int))
+ return -1;
+ return Threads_WaitTID(a0, a1);
+);
+SYSCALL1(Syscall_SetUID, "i", int,
+ if(Sizes[0] < sizeof(int)) {
+ *Errno = -EINVAL; // TODO: Better message
+ return -1;
+ }
+ return Threads_SetUID(a0);
+);
+SYSCALL1(Syscall_SetGID, "i", int,
+ if(Sizes[0] < sizeof(int)) {
+ *Errno = -EINVAL; // TODO: Better message
+ return -1;
+ }
+ return Threads_SetGID(a0);
+);
+
+SYSCALL0(Syscall_GetTID, return Threads_GetTID());
+SYSCALL0(Syscall_GetPID, return Threads_GetPID());
+SYSCALL0(Syscall_GetUID, return Threads_GetUID());
+SYSCALL0(Syscall_GetGID, return Threads_GetGID());
+
+SYSCALL1(Syscall_AN_Fork, "d", int *,
+ if(Sizes[0] < sizeof(int))
+ return -1;
+ *a0 = Threads_Fork();
+ return *a0;
+);
+
+SYSCALL2(Syscall_SendMessage, "id", int, void *,
+ return Proc_SendMessage(a0, Sizes[1], a1);
+);
+
+SYSCALL2(Syscall_GetMessage, "dd", uint32_t *, void *,
+ if( a0 && Sizes[0] < sizeof(*a0) ) {
+ Log_Notice("Syscalls", "Syscall_GetMessage - Arg 1 Undersize (%i < %i)",
+ Sizes[0], sizeof(*a0));
+ return -1;
+ }
+ Uint tmp;
+ int rv;
+ if( a0 ) {
+ rv = Proc_GetMessage(&tmp, Sizes[1], a1);
+ *a0 = tmp;
+ }
+ else
+ rv = Proc_GetMessage(NULL, Sizes[1], a1);
+ return rv;
+);
+
+SYSCALL1(Syscall_WaitEvent, "i", int,
+ return Threads_WaitEvents(a0);
+);