mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-15 03:00:43 +02:00
The vast majoirty of syscalls don't need anything in thread or frame. So lets save an indirection for all those syscalls. Most of the syscalls which do need Thread (or CTX via Thread are in Thread.cpp or Memory.cpp These have all been modifiy to fetch Thread from Frame
52 lines
2.0 KiB
C++
52 lines
2.0 KiB
C++
#include "Tests/LinuxSyscalls/Syscalls.h"
|
|
#include "Tests/LinuxSyscalls/x64/Syscalls.h"
|
|
#include "Tests/LinuxSyscalls/x32/Syscalls.h"
|
|
|
|
#include <linux/aio_abi.h>
|
|
#include <sys/syscall.h>
|
|
#include <unistd.h>
|
|
|
|
namespace FEX::HLE {
|
|
void RegisterIO() {
|
|
REGISTER_SYSCALL_IMPL(iopl, [](FEXCore::Core::CpuStateFrame *Frame, int level) -> uint64_t {
|
|
// Just claim we don't have permission
|
|
return -EPERM;
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(ioperm, [](FEXCore::Core::CpuStateFrame *Frame, unsigned long from, unsigned long num, int turn_on) -> uint64_t {
|
|
// ioperm not available on our architecture
|
|
return -EPERM;
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(io_setup, [](FEXCore::Core::CpuStateFrame *Frame, unsigned nr_events, aio_context_t *ctx_idp) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_io_setup, nr_events, ctx_idp);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(io_destroy, [](FEXCore::Core::CpuStateFrame *Frame, aio_context_t ctx_id) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_io_destroy, ctx_id);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(io_submit, [](FEXCore::Core::CpuStateFrame *Frame, aio_context_t ctx_id, long nr, struct iocb **iocbpp) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_io_submit, ctx_id, nr, iocbpp);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(io_cancel, [](FEXCore::Core::CpuStateFrame *Frame, aio_context_t ctx_id, struct iocb *iocb, struct io_event *result) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_io_cancel, ctx_id, iocb, result);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(ioprio_set, [](FEXCore::Core::CpuStateFrame *Frame, int which, int who) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_ioprio_set, which, who);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(ioprio_get, [](FEXCore::Core::CpuStateFrame *Frame, int which, int who, int ioprio) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_ioprio_get, which, who, ioprio);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
}
|
|
}
|