1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 03:35:09 +00:00

Kernel: Use a lookup table for syscalls

Instead of the big ugly switch statement, build a lookup table using
the syscall enumeration macro.

This greatly simplifies the syscall implementation. :^)
This commit is contained in:
Andreas Kling 2019-11-09 22:18:16 +01:00
parent 874ebbe4a5
commit fbeb1ab15b
5 changed files with 69 additions and 277 deletions

View file

@ -5,6 +5,7 @@
#include <AK/Types.h>
#include <Kernel/Arch/i386/CPU.h>
#include <Kernel/Arch/i386/PIT.h>
#include <Kernel/Console.h>
#include <Kernel/Devices/NullDevice.h>
#include <Kernel/Devices/RandomDevice.h>
#include <Kernel/FileSystem/Custody.h>
@ -3196,3 +3197,26 @@ int Process::sys$clock_nanosleep(const Syscall::SC_clock_nanosleep_params* param
return -EINVAL;
}
}
int Process::sys$sync()
{
VFS::the().sync();
return 0;
}
int Process::sys$putch(char ch)
{
Console::the().put_char(ch);
return 0;
}
int Process::sys$yield()
{
return Scheduler::yield();
}
int Process::sys$beep()
{
Scheduler::beep();
return 0;
}