Support sleep

This commit is contained in:
tuyuyang
2024-08-25 23:29:34 +08:00
parent 6ae8b6e160
commit 968d66e5a9
13 changed files with 123 additions and 5 deletions
@@ -153,4 +153,9 @@ bool semaphore_wait(int sem_id)
bool semaphore_signal(int sem_id)
{
return syscall(SYSCALL_SEMAPHORE, (intptr_t)SYS_SEM_SIGNAL, (intptr_t)sem_id, 0, 0);
}
int sleep(intptr_t ms)
{
return syscall(SYSCALL_SLEEP, (intptr_t)ms, 0, 0, 0);
}
@@ -34,6 +34,7 @@
#define SYSCALL_KILL 12 // kill the task by id
#define SYSCALL_SEMAPHORE 13 // semaphore related operations
#define SYSCALL_SLEEP 14 // sleep
// clang-format on
typedef enum {
@@ -105,4 +106,6 @@ uintptr_t get_tick();
int semaphore_new(int val);
bool semaphore_free(int sem_id);
bool semaphore_wait(int sem_id);
bool semaphore_signal(int sem_id);
bool semaphore_signal(int sem_id);
int sleep(intptr_t ms);