diff --git a/SystemCalls/Native.cpp b/SystemCalls/Native.cpp index 065ef88..d1c40bd 100644 --- a/SystemCalls/Native.cpp +++ b/SystemCalls/Native.cpp @@ -163,6 +163,14 @@ static int sys_file_status(SyscallsFrame *Frame) return SYSCALL_NOT_IMPLEMENTED; } +static int sys_sleep(SyscallsFrame *Frame, uint64_t Milliseconds) +{ + if (!CheckTrust(TrustedByKernel | Trusted | Untrusted)) + return SYSCALL_ACCESS_DENIED; + TaskManager->Sleep(Milliseconds); + return 0; +} + static int sys_wait(SyscallsFrame *Frame) { fixme("sys_wait: %#lx", Frame); @@ -259,6 +267,7 @@ static void *NativeSyscallsTable[] = { [_FileSeek] = (void *)sys_file_seek, [_FileStatus] = (void *)sys_file_status, + [_Sleep] = (void *)sys_sleep, [_Wait] = (void *)sys_wait, [_Kill] = (void *)sys_kill, [_Spawn] = (void *)sys_spawn, diff --git a/syscalls.h b/syscalls.h index 20bd9f3..5719ed7 100644 --- a/syscalls.h +++ b/syscalls.h @@ -88,6 +88,12 @@ enum NativeSyscalls */ _FileStatus, + /** @brief Sleep for a specific amount of time + * @fn int Sleep(uint64_t Milliseconds) + * This syscall is used to sleep the current thread for a specific amount of time. + */ + _Sleep, + /** @brief Wait for a process or a thread * @fn * This syscall is used to wait for a specific process or thread to terminate. It returns the exit code of the process or thread.