#include <acess.h>
#include <syscalls.h>
#include <proc.h>
+#include <hal_proc.h>
#include <errno.h>
#include <threads.h>
// -- Clone the current thread
case SYS_CLONE:
// Call clone system call
- ret = Proc_Clone(&err, Regs->Arg1);
- // Change user stack if a new stack address is passed
- if(ret == 0 && Regs->Arg2)
- Regs->StackPointer = Regs->Arg2;
+ ret = Proc_Clone(Regs->Arg1);
break;
// -- Send a signal
CHECK_NUM_NONULL( &tmp[i], sizeof(char*) );
CHECK_STR_NONULL( tmp[i] );
}
+ if(ret == -1) break;
// Check EnvP also
// - EnvP can be NULL
if( Regs->Arg3 )
{
tmp = (char**)Regs->Arg3;
- //Log("tmp = %p", tmp);
+ CHECK_NUM_NONULL(tmp, sizeof(char**));
+ Log("tmp = %p", tmp);
for(i=0;tmp[i];i++) {
- CHECK_NUM_NULLOK( &tmp[i], sizeof(char*) );
+ CHECK_NUM_NONULL( &tmp[i], sizeof(char*) );
CHECK_STR_NONULL( tmp[i] );
}
+ if(ret == -1) break;
}
}
LEAVE('s', "Assuming 0");
// Open a file that is a entry in an open directory
case SYS_OPENCHILD:
CHECK_STR_NONULL( (char*)Regs->Arg2 );
- ret = VFS_OpenChild( &err, Regs->Arg1, (char*)Regs->Arg2, Regs->Arg3);
+ ret = VFS_OpenChild( Regs->Arg1, (char*)Regs->Arg2, Regs->Arg3);
break;
// Change Directory
// -- Debug
//#if DEBUG_BUILD
case SYS_DEBUG:
- LogF("Log: [%i] ", Threads_GetTID());
- LogF((char*)Regs->Arg1,
+ CHECK_STR_NONULL( (char*)Regs->Arg1 );
+ LogF("Log: %08lli [%i] ", now(), Threads_GetTID());
+ LogF((const char*)Regs->Arg1,
Regs->Arg2, Regs->Arg3, Regs->Arg4, Regs->Arg5, Regs->Arg6);
- LogF("\n");
+ LogF("\r\n");
break;
//#endif
// -- Default (Return Error)
default:
- Warning("SyscallHandler: Unknown System Call %i", Regs->Num);
+ Log_Warning("Syscalls", "Unknown System Call %i", Regs->Num);
if(Regs->Num < NUM_SYSCALLS)
- Warning(" Syscall '%s'", cSYSCALL_NAMES[Regs->Num]);
+ Log_Warning("Syscall", " named '%s'", cSYSCALL_NAMES[Regs->Num]);
err = -ENOSYS;
ret = -1;
break;
}
+
+ if(err == 0) err = errno;
if(err != 0) {
LOG("ID: %i, Return errno = %i", Regs->Num, err);
if( callNum != SYS_READ && callNum != SYS_WRITE ) {
# endif
LOG("err = %i", err);
- if(Regs->Num != SYS_EXECVE)
- LEAVE('x', ret);
- else
+ if( callNum == SYS_EXECVE )
LOG("Actual %i", ret);
+ else
+ LEAVE('x', ret);
# if DEBUG < 2
}
# endif