24 lines
578 B
C++
24 lines
578 B
C++
|
#include "sys/Syscall.h"
|
||
|
#include "io/Serial.h"
|
||
|
#include "thread/Scheduler.h"
|
||
|
|
||
|
void Syscall::entry(Context* context)
|
||
|
{
|
||
|
asm volatile("cli");
|
||
|
switch (context->rax)
|
||
|
{
|
||
|
case SYS_exit: // sys_exit
|
||
|
sys_exit(context);
|
||
|
break;
|
||
|
case SYS_yield: // sys_yield
|
||
|
sys_yield(context);
|
||
|
break;
|
||
|
case SYS_sleep: // sys_sleep
|
||
|
sys_sleep(context, context->rdi);
|
||
|
break;
|
||
|
case SYS_write: // sys_write
|
||
|
sys_write(context, (const char*)context->rdi, context->rsi);
|
||
|
break;
|
||
|
default: context->rax = -1; break;
|
||
|
}
|
||
|
}
|