1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

Kernel+UserspaceEmulator: Add sys$emuctl() system call

This returns ENOSYS if you are running in the real kernel, and some
other result if you are running in UserspaceEmulator.

There are other ways we could check if we're inside an emulator, but
it seemed easier to just ask. :^)
This commit is contained in:
Andreas Kling 2021-03-09 08:16:00 +01:00
parent d650b38eb9
commit 84725ef3a5
6 changed files with 48 additions and 1 deletions

View file

@ -518,6 +518,8 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
return virt$getrandom(arg1, arg2, arg3);
case SC_fork:
return virt$fork();
case SC_emuctl:
return virt$emuctl();
case SC_sched_getparam:
return virt$sched_getparam(arg1, arg2);
case SC_sched_setparam:
@ -1265,6 +1267,11 @@ int Emulator::virt$ioctl([[maybe_unused]] int fd, unsigned request, [[maybe_unus
TODO();
}
int Emulator::virt$emuctl()
{
return 0;
}
int Emulator::virt$fork()
{
int rc = fork();