switch(Regs->Num)
{
// -- Exit the current thread
- case SYS_EXIT: Threads_Exit(); break;
+ case SYS_EXIT: Threads_Exit(0, Regs->Arg1); break;
// -- Put the current thread to sleep
case SYS_SLEEP: Threads_Sleep(); break;
case SYS_GETUID: ret = Threads_GetUID(); break;
case SYS_GETGID: ret = Threads_GetGID(); break;
+ // -- Set User/Group IDs
+ case SYS_SETUID: Log("Setting User ID to %i", Regs->Arg1); break;
+ case SYS_SETGID: Log("Setting Group ID to %i", Regs->Arg1); break;
+
// -- Send Message
case SYS_SENDMSG:
ret = Proc_SendMessage(&err, Regs->Arg1, Regs->Arg2, (void*)Regs->Arg3);
ret = Proc_Execve((char*)Regs->Arg1, (char**)Regs->Arg2, (char**)Regs->Arg3);
break;
case SYS_LOADBIN:
+ if( !Syscall_ValidString(Regs->Arg1)
+ || !Syscall_Valid(sizeof(Uint), Regs->Arg2) ) {
+ err = -EINVAL;
+ ret = -1;
+ break;
+ }
ret = Binary_Load((char*)Regs->Arg1, (Uint*)Regs->Arg2);
break;
// Virtual Filesystem
// ---
case SYS_OPEN:
+ if( !Syscall_ValidString(Regs->Arg1) ) {
+ err = -EINVAL;
+ ret = -1;
+ break;
+ }
ret = VFS_Open((char*)Regs->Arg1, Regs->Arg2 | VFS_OPENFLAG_USER);
break;
case SYS_WRITE:
#if BITS < 64
- VFS_Write( Regs->Arg1, Regs->Arg2|((Uint64)Regs->Arg3<<32), (void*)Regs->Arg4 );
+ ret = VFS_Write( Regs->Arg1, Regs->Arg2|((Uint64)Regs->Arg3<<32), (void*)Regs->Arg4 );
#else
- VFS_Write( Regs->Arg1, Regs->Arg2, (void*)Regs->Arg3 );
+ ret = VFS_Write( Regs->Arg1, Regs->Arg2, (void*)Regs->Arg3 );
#endif
break;
case SYS_READ:
#if BITS < 64
- VFS_Read( Regs->Arg1, Regs->Arg2|((Uint64)Regs->Arg3<<32), (void*)Regs->Arg4 );
+ ret = VFS_Read( Regs->Arg1, Regs->Arg2|((Uint64)Regs->Arg3<<32), (void*)Regs->Arg4 );
#else
- VFS_Read( Regs->Arg1, Regs->Arg2, (void*)Regs->Arg3 );
+ ret = VFS_Read( Regs->Arg1, Regs->Arg2, (void*)Regs->Arg3 );
#endif
break;