mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
40 lines
997 B
C++
40 lines
997 B
C++
#include <syscalls.hpp>
|
|
|
|
#include <debug.h>
|
|
|
|
#include "../kernel.h"
|
|
|
|
NewLock(SyscallsLock);
|
|
|
|
extern "C" uintptr_t SystemCallsHandler(SyscallsFrame *Frame)
|
|
{
|
|
CPU::Interrupts(CPU::Enable);
|
|
SmartLock(SyscallsLock); /* TODO: This should be replaced or moved somewhere else. */
|
|
|
|
#if defined(a64)
|
|
switch (TaskManager->GetCurrentThread()->Info.Compatibility)
|
|
{
|
|
case Tasking::TaskCompatibility::Native:
|
|
return HandleNativeSyscalls(Frame);
|
|
case Tasking::TaskCompatibility::Linux:
|
|
return HandleLinuxSyscalls(Frame);
|
|
case Tasking::TaskCompatibility::Windows:
|
|
{
|
|
error("Windows compatibility not implemented yet.");
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
error("Unknown compatibility mode! Killing thread...");
|
|
TaskManager->KillThread(TaskManager->GetCurrentThread(), -0xCA11);
|
|
break;
|
|
}
|
|
}
|
|
#elif defined(a32)
|
|
fixme("System call %lld", Frame->eax);
|
|
#elif defined(aa64)
|
|
fixme("System call");
|
|
#endif
|
|
return -1;
|
|
}
|