From 0dc7fd75e1eb085bb36da8d4e63837687b42e6ff Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 10 Mar 2021 17:43:21 -0800 Subject: [PATCH] Adds a couple new 32bit syscalls found while running Steam These are straightforward to implement. Only a few dozen more syscalls missing on 32bit --- Source/Tests/LinuxSyscalls/x32/Memory.cpp | 12 ++++++++++++ Source/Tests/LinuxSyscalls/x32/Semaphore.cpp | 5 +++++ Source/Tests/LinuxSyscalls/x32/Thread.cpp | 11 +++++++++++ 3 files changed, 28 insertions(+) diff --git a/Source/Tests/LinuxSyscalls/x32/Memory.cpp b/Source/Tests/LinuxSyscalls/x32/Memory.cpp index c43f85390..4ec7687fb 100644 --- a/Source/Tests/LinuxSyscalls/x32/Memory.cpp +++ b/Source/Tests/LinuxSyscalls/x32/Memory.cpp @@ -86,6 +86,18 @@ namespace FEX::HLE::x32 { uint64_t Result = ::munlock(reinterpret_cast(0x1'0000), 0x1'0000'0000ULL - 0x1'0000); SYSCALL_ERRNO(); }); + + REGISTER_SYSCALL_IMPL_X32(shmat, [](FEXCore::Core::CpuStateFrame *Frame, int shmid, const void *shmaddr, int shmflg) -> uint64_t { + uint32_t ResultAddr{}; + uint64_t Result = static_cast(FEX::HLE::_SyscallHandler)->GetAllocator()-> + shmat(shmid, reinterpret_cast(shmaddr), shmflg, &ResultAddr); + if (Result == 0) { + return ResultAddr; + } + else { + return Result; + } + }); } } diff --git a/Source/Tests/LinuxSyscalls/x32/Semaphore.cpp b/Source/Tests/LinuxSyscalls/x32/Semaphore.cpp index 949c2231b..391d07470 100644 --- a/Source/Tests/LinuxSyscalls/x32/Semaphore.cpp +++ b/Source/Tests/LinuxSyscalls/x32/Semaphore.cpp @@ -790,5 +790,10 @@ namespace FEX::HLE::x32 { } void RegisterSemaphore() { REGISTER_SYSCALL_IMPL_X32(ipc, _ipc); + + REGISTER_SYSCALL_IMPL_X32(semtimedop_time64, [](FEXCore::Core::CpuStateFrame *Frame, int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout) -> uint64_t { + uint64_t Result = ::semtimedop(semid, sops, nsops, timeout); + SYSCALL_ERRNO(); + }); } } diff --git a/Source/Tests/LinuxSyscalls/x32/Thread.cpp b/Source/Tests/LinuxSyscalls/x32/Thread.cpp index 3b4cb65c7..3e0c9cc3d 100644 --- a/Source/Tests/LinuxSyscalls/x32/Thread.cpp +++ b/Source/Tests/LinuxSyscalls/x32/Thread.cpp @@ -340,5 +340,16 @@ namespace FEX::HLE::x32 { } SYSCALL_ERRNO(); }); + + REGISTER_SYSCALL_IMPL_X32(futex_time64, [](FEXCore::Core::CpuStateFrame *Frame, int *uaddr, int futex_op, int val, const struct timespec *timeout, int *uaddr2, uint32_t val3) -> uint64_t { + uint64_t Result = syscall(SYS_futex, + uaddr, + futex_op, + val, + timeout, + uaddr2, + val3); + SYSCALL_ERRNO(); + }); } }