I removed the intermediate function when calling syscalls. Now syscall handler calls the current process automatically. Only exception is sys_fork, since it needs a assembly trampoline for the new thread.