mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Added stub syscalls
This commit is contained in:
parent
8a195c124c
commit
fe96c7b083
@ -6,6 +6,8 @@
|
|||||||
#include "../syscalls.h"
|
#include "../syscalls.h"
|
||||||
#include "../kernel.h"
|
#include "../kernel.h"
|
||||||
|
|
||||||
|
#include "../../Userspace/libs/include/sysbase.h"
|
||||||
|
|
||||||
static int sys_exit(SyscallsFrame *Frame, int code)
|
static int sys_exit(SyscallsFrame *Frame, int code)
|
||||||
{
|
{
|
||||||
trace("Userspace thread %s(%lld) exited with code %#llx", TaskManager->GetCurrentThread()->Name, TaskManager->GetCurrentThread()->ID, code);
|
trace("Userspace thread %s(%lld) exited with code %#llx", TaskManager->GetCurrentThread()->Name, TaskManager->GetCurrentThread()->ID, code);
|
||||||
@ -40,13 +42,141 @@ static int sys_free_pages(SyscallsFrame *Frame, uintptr_t Address, size_t Count)
|
|||||||
|
|
||||||
static int sys_kernelctl(SyscallsFrame *Frame, int Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4)
|
static int sys_kernelctl(SyscallsFrame *Frame, int Command, uint64_t Arg1, uint64_t Arg2, uint64_t Arg3, uint64_t Arg4)
|
||||||
{
|
{
|
||||||
fixme("KernelCTL: %lld", Command);
|
switch (Command)
|
||||||
|
{
|
||||||
|
case KCTL_GET_PID:
|
||||||
|
return TaskManager->GetCurrentThread()->Parent->ID;
|
||||||
|
case KCTL_GET_TID:
|
||||||
|
return TaskManager->GetCurrentThread()->ID;
|
||||||
|
case KCTL_GET_PAGE_SIZE:
|
||||||
|
return PAGE_SIZE;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
warn("KernelCTL: Unknown command: %lld", Command);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UNUSED(Arg1);
|
UNUSED(Arg1);
|
||||||
UNUSED(Arg2);
|
UNUSED(Arg2);
|
||||||
UNUSED(Arg3);
|
UNUSED(Arg3);
|
||||||
UNUSED(Arg4);
|
UNUSED(Arg4);
|
||||||
UNUSED(Frame);
|
UNUSED(Frame);
|
||||||
return 0;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_open(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_open: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_close(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_close: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_read(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_read: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_write(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_write: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_seek(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_seek: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_file_status(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_file_status: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_wait(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_wait: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_kill(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_kill: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_spawn(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_spawn: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_spawn_thread(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_spawn_thread: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_get_thread_list_of_process(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_get_thread_list_of_process: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_get_current_process(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_get_current_process: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_get_current_thread(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_get_current_thread: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_get_process_by_pid(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_get_process_by_pid: %#lx, %#lx, %d", Frame, Buffer, Count);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_get_thread_by_tid(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_get_thread_by_tid: %#lx, %#lx, %d", Frame, Buffer, Count);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_kill_process(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_kill_process: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_kill_thread(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_kill_thread: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_sys_reserved_create_process(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_sys_reserved_create_process: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sys_sys_reserved_create_thread(SyscallsFrame *Frame)
|
||||||
|
{
|
||||||
|
fixme("sys_sys_reserved_create_thread: %#lx", Frame);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *NativeSyscallsTable[] = {
|
static void *NativeSyscallsTable[] = {
|
||||||
@ -57,6 +187,27 @@ static void *NativeSyscallsTable[] = {
|
|||||||
[_FreePages] = (void *)sys_free_pages,
|
[_FreePages] = (void *)sys_free_pages,
|
||||||
|
|
||||||
[_KernelCTL] = (void *)sys_kernelctl,
|
[_KernelCTL] = (void *)sys_kernelctl,
|
||||||
|
|
||||||
|
[_FileOpen] = (void *)sys_file_open,
|
||||||
|
[_FileClose] = (void *)sys_file_close,
|
||||||
|
[_FileRead] = (void *)sys_file_read,
|
||||||
|
[_FileWrite] = (void *)sys_file_write,
|
||||||
|
[_FileSeek] = (void *)sys_file_seek,
|
||||||
|
[_FileStatus] = (void *)sys_file_status,
|
||||||
|
|
||||||
|
[_Wait] = (void *)sys_wait,
|
||||||
|
[_Kill] = (void *)sys_kill,
|
||||||
|
[_Spawn] = (void *)sys_spawn,
|
||||||
|
[_SpawnThread] = (void *)sys_spawn_thread,
|
||||||
|
[_GetThreadListOfProcess] = (void *)sys_get_thread_list_of_process,
|
||||||
|
[_GetCurrentProcess] = (void *)sys_get_current_process,
|
||||||
|
[_GetCurrentThread] = (void *)sys_get_current_thread,
|
||||||
|
[_GetProcessByPID] = (void *)sys_get_process_by_pid,
|
||||||
|
[_GetThreadByTID] = (void *)sys_get_thread_by_tid,
|
||||||
|
[_KillProcess] = (void *)sys_kill_process,
|
||||||
|
[_KillThread] = (void *)sys_kill_thread,
|
||||||
|
[_SysReservedCreateProcess] = (void *)sys_sys_reserved_create_process,
|
||||||
|
[_SysReservedCreateThread] = (void *)sys_sys_reserved_create_thread,
|
||||||
};
|
};
|
||||||
|
|
||||||
uintptr_t HandleNativeSyscalls(SyscallsFrame *Frame)
|
uintptr_t HandleNativeSyscalls(SyscallsFrame *Frame)
|
||||||
|
21
syscalls.h
21
syscalls.h
@ -12,6 +12,27 @@ enum NativeSyscalls
|
|||||||
_FreePages,
|
_FreePages,
|
||||||
|
|
||||||
_KernelCTL,
|
_KernelCTL,
|
||||||
|
|
||||||
|
_FileOpen,
|
||||||
|
_FileClose,
|
||||||
|
_FileRead,
|
||||||
|
_FileWrite,
|
||||||
|
_FileSeek,
|
||||||
|
_FileStatus,
|
||||||
|
|
||||||
|
_Wait,
|
||||||
|
_Kill,
|
||||||
|
_Spawn,
|
||||||
|
_SpawnThread,
|
||||||
|
_GetThreadListOfProcess,
|
||||||
|
_GetCurrentProcess,
|
||||||
|
_GetCurrentThread,
|
||||||
|
_GetProcessByPID,
|
||||||
|
_GetThreadByTID,
|
||||||
|
_KillProcess,
|
||||||
|
_KillThread,
|
||||||
|
_SysReservedCreateProcess,
|
||||||
|
_SysReservedCreateThread,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline long syscall0(long syscall)
|
static inline long syscall0(long syscall)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user