mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 16:00:44 +02:00
Sadly these things can't be split without breaking functionality so it turns in to a bit of a mess. SyscallHandler is very much something that is a Linux only construct and shouldn't be in FEXCore itself. Lets the frontend register a Syscallhandler with FEXCore. FEXCore itself is then aware of the current syscall ABI and handles the ABI in an optimal fashion. So it is not a 100% clean break otherwise we would lose performance. The SignalDelegator then needs to move to the frontend since the SyscallHandler requires it for signal based syscalls. The CPU backend signal handling still needs to happen in FEXCore because it is a very tight coupling with the CPU backend. Once we need to support more Signal handling we can give the backends cleaner support to select which specific OS handler to handle.
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::InternalThreadState *Thread, int level) -> uint64_t {
|
|
// Just claim we don't have permission
|
|
return -EPERM;
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(ioperm, [](FEXCore::Core::InternalThreadState *Thread, 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::InternalThreadState *Thread, 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::InternalThreadState *Thread, 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::InternalThreadState *Thread, 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::InternalThreadState *Thread, 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::InternalThreadState *Thread, int which, int who) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_ioprio_set, which, who);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
|
|
REGISTER_SYSCALL_IMPL(ioprio_get, [](FEXCore::Core::InternalThreadState *Thread, int which, int who, int ioprio) -> uint64_t {
|
|
uint64_t Result = ::syscall(SYS_ioprio_get, which, who, ioprio);
|
|
SYSCALL_ERRNO();
|
|
});
|
|
}
|
|
}
|