2023-01-05 21:39:56 +00:00
|
|
|
#include "sys/Syscall.h"
|
|
|
|
#include "thread/Scheduler.h"
|
|
|
|
|
2023-03-23 21:25:56 +00:00
|
|
|
Result<u64> sys_exit(Registers*, SyscallArgs args)
|
2023-01-05 21:39:56 +00:00
|
|
|
{
|
2023-03-23 21:25:56 +00:00
|
|
|
u8 status = (u8)args[0];
|
|
|
|
|
|
|
|
Thread* current = Scheduler::current();
|
|
|
|
|
|
|
|
current->status = status;
|
|
|
|
current->state = ThreadState::Exited;
|
|
|
|
|
|
|
|
kernel_yield();
|
2023-01-05 21:39:56 +00:00
|
|
|
}
|