2022-09-29 17:17:43 +00:00
|
|
|
#include "thread/Scheduler.h"
|
|
|
|
|
|
|
|
void sys_exit(Context* context)
|
|
|
|
{
|
|
|
|
Scheduler::task_exit(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sys_yield(Context* context)
|
|
|
|
{
|
|
|
|
context->rax = 0;
|
|
|
|
Scheduler::task_yield(context);
|
|
|
|
}
|
|
|
|
|
|
|
|
void sys_sleep(Context* context, uint64_t ms)
|
|
|
|
{
|
|
|
|
context->rax = 0;
|
|
|
|
Task* task = Scheduler::current_task();
|
|
|
|
task->task_sleep = ms;
|
|
|
|
task->state = task->Sleeping;
|
|
|
|
Scheduler::task_yield(context);
|
2022-10-01 15:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void sys_gettid(Context* context)
|
|
|
|
{
|
|
|
|
context->rax = Scheduler::current_task()->id;
|
2022-09-29 17:17:43 +00:00
|
|
|
}
|