Add Sleep syscall

This commit is contained in:
Alex 2023-03-20 01:35:59 +02:00
parent ac0c9505f3
commit ff214dc10b
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 15 additions and 0 deletions

View File

@ -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,

View File

@ -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.