mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-27 15:04:31 +00:00
kernel: Update syscall header
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
7d85dd5dd8
commit
37c3ee8e99
@ -31,13 +31,14 @@ typedef struct SyscallsFrame
|
||||
uint64_t r10;
|
||||
uint64_t r9;
|
||||
uint64_t r8;
|
||||
uint64_t rbp;
|
||||
uint64_t rdi;
|
||||
uint64_t rsi;
|
||||
uint64_t rdx;
|
||||
uint64_t rcx;
|
||||
uint64_t rbx;
|
||||
uint64_t rax;
|
||||
|
||||
uint64_t bp;
|
||||
uint64_t di;
|
||||
uint64_t si;
|
||||
uint64_t dx;
|
||||
uint64_t cx;
|
||||
uint64_t bx;
|
||||
uint64_t ax;
|
||||
|
||||
uint64_t ReturnAddress;
|
||||
uint64_t CodeSegment;
|
||||
@ -45,13 +46,13 @@ typedef struct SyscallsFrame
|
||||
uint64_t StackPointer;
|
||||
uint64_t StackSegment;
|
||||
#elif defined(__i386__)
|
||||
uint32_t ebp;
|
||||
uint32_t edi;
|
||||
uint32_t esi;
|
||||
uint32_t edx;
|
||||
uint32_t ecx;
|
||||
uint32_t ebx;
|
||||
uint32_t eax;
|
||||
uint32_t bp;
|
||||
uint32_t di;
|
||||
uint32_t si;
|
||||
uint32_t dx;
|
||||
uint32_t cx;
|
||||
uint32_t bx;
|
||||
uint32_t ax;
|
||||
|
||||
uint32_t ReturnAddress;
|
||||
uint32_t CodeSegment;
|
||||
@ -62,6 +63,83 @@ typedef struct SyscallsFrame
|
||||
uint32_t ReturnAddress;
|
||||
uint32_t StackPointer;
|
||||
#endif
|
||||
|
||||
uintptr_t ReturnValue() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return ax;
|
||||
#elif defined(__i386__)
|
||||
return ax;
|
||||
#elif defined(__aarch64__)
|
||||
return x0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg0() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return di;
|
||||
#elif defined(__i386__)
|
||||
return di;
|
||||
#elif defined(__aarch64__)
|
||||
return x0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg1() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return si;
|
||||
#elif defined(__i386__)
|
||||
return cx;
|
||||
#elif defined(__aarch64__)
|
||||
return x1;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg2() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return dx;
|
||||
#elif defined(__i386__)
|
||||
return dx;
|
||||
#elif defined(__aarch64__)
|
||||
return x2;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg3() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return r10;
|
||||
#elif defined(__i386__)
|
||||
return si;
|
||||
#elif defined(__aarch64__)
|
||||
return x3;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg4() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return r8;
|
||||
#elif defined(__i386__)
|
||||
return di;
|
||||
#elif defined(__aarch64__)
|
||||
return x4;
|
||||
#endif
|
||||
}
|
||||
|
||||
uintptr_t Arg5() const
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
return r9;
|
||||
#elif defined(__i386__)
|
||||
return bp;
|
||||
#elif defined(__aarch64__)
|
||||
return x5;
|
||||
#endif
|
||||
}
|
||||
} SyscallsFrame;
|
||||
#define SysFrm SyscallsFrame
|
||||
|
||||
|
@ -4259,14 +4259,14 @@ static SyscallData LinuxSyscallsTableI386[] = {
|
||||
uintptr_t HandleLinuxSyscalls(SyscallsFrame *Frame)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
if (Frame->rax > sizeof(LinuxSyscallsTableAMD64) / sizeof(SyscallData))
|
||||
if (Frame->ax > sizeof(LinuxSyscallsTableAMD64) / sizeof(SyscallData))
|
||||
{
|
||||
fixme("Syscall %d not implemented",
|
||||
Frame->rax);
|
||||
Frame->ax);
|
||||
return -linux_ENOSYS;
|
||||
}
|
||||
|
||||
SyscallData Syscall = LinuxSyscallsTableAMD64[Frame->rax];
|
||||
SyscallData Syscall = LinuxSyscallsTableAMD64[Frame->ax];
|
||||
|
||||
long (*call)(SysFrm *, long, ...) = r_cst(long (*)(SysFrm *, long, ...),
|
||||
Syscall.Handler);
|
||||
@ -4274,20 +4274,20 @@ uintptr_t HandleLinuxSyscalls(SyscallsFrame *Frame)
|
||||
if (unlikely(!call))
|
||||
{
|
||||
fixme("Syscall %s(%d) not implemented",
|
||||
Syscall.Name, Frame->rax);
|
||||
Syscall.Name, Frame->ax);
|
||||
return -linux_ENOSYS;
|
||||
}
|
||||
|
||||
debug("> [%d:\"%s\"]( %#lx %#lx %#lx %#lx %#lx %#lx )",
|
||||
Frame->rax, Syscall.Name,
|
||||
Frame->rdi, Frame->rsi, Frame->rdx,
|
||||
Frame->ax, Syscall.Name,
|
||||
Frame->di, Frame->si, Frame->dx,
|
||||
Frame->r10, Frame->r8, Frame->r9);
|
||||
|
||||
long sc_ret = call(Frame,
|
||||
Frame->rdi, Frame->rsi, Frame->rdx,
|
||||
Frame->di, Frame->si, Frame->dx,
|
||||
Frame->r10, Frame->r8, Frame->r9);
|
||||
|
||||
debug("< [%ld:\"%s\"] = %ld", Frame->rax, Syscall.Name, sc_ret);
|
||||
debug("< [%ld:\"%s\"] = %ld", Frame->ax, Syscall.Name, sc_ret);
|
||||
return sc_ret;
|
||||
#elif defined(__i386__)
|
||||
if (Frame->eax > sizeof(LinuxSyscallsTableI386) / sizeof(SyscallData))
|
||||
|
@ -462,13 +462,13 @@ namespace Tasking
|
||||
sf->r10 = si->tf.r10;
|
||||
sf->r9 = si->tf.r9;
|
||||
sf->r8 = si->tf.r8;
|
||||
sf->rbp = si->tf.rbp;
|
||||
sf->rdi = si->tf.rdi;
|
||||
sf->rsi = si->tf.rsi;
|
||||
sf->rdx = si->tf.rdx;
|
||||
sf->rcx = si->tf.rcx;
|
||||
sf->rbx = si->tf.rbx;
|
||||
sf->rax = si->tf.rax;
|
||||
sf->bp = si->tf.rbp;
|
||||
sf->di = si->tf.rdi;
|
||||
sf->si = si->tf.rsi;
|
||||
sf->dx = si->tf.rdx;
|
||||
sf->cx = si->tf.rcx;
|
||||
sf->bx = si->tf.rbx;
|
||||
sf->ax = si->tf.rax;
|
||||
sf->Flags = si->tf.rflags.raw;
|
||||
sf->ReturnAddress = si->tf.rip;
|
||||
gs->TempStack = (void *)si->tf.rsp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user