From d1e8bcd7a5bb11e6bbfa57e7dae29d9dd896104c Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 9 Sep 2023 14:20:09 +0200 Subject: Added syscall 282 (for #965) --- src/emu/x64syscall.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c index 24dd442c..7eb2d533 100644 --- a/src/emu/x64syscall.c +++ b/src/emu/x64syscall.c @@ -5,6 +5,7 @@ #include #include /* For SYS_xxx definitions */ +#include #include #include #include @@ -246,6 +247,7 @@ static scwrap_t syscallwrap[] = { #ifdef NOALIGN { 281, __NR_epoll_pwait, 6}, #endif + //{ 282, __NR__signalfd, 3}, #ifdef _NR_eventfd { 284, __NR_eventfd, 1}, #endif @@ -731,6 +733,19 @@ void EXPORT x64Syscall(x64emu_t *emu) R_RAX = (uint64_t)-errno; break; #endif + case 282: // sys_signalfd + // need to mask SIGSEGV + { + sigset_t * set = (sigset_t *)R_RSI; + if(sigismember(set, SIGSEGV)) { + sigdelset(set, SIGSEGV); + printf_log(LOG_INFO, "Warning, signalfd on SIGSEGV unsuported\n"); + } + R_EAX = signalfd((int)R_EDI, set, 0); + if(R_EAX==-1) + R_EAX = -errno; + } + break; case 317: // sys_seccomp R_RAX = 0; // ignoring call break; @@ -980,6 +995,17 @@ uintptr_t EXPORT my_syscall(x64emu_t *emu) return (uint64_t)(int64_t)my_epoll_pwait(emu, (int)R_ESI, (void*)R_RDX, (int)R_ECX, (int)R_R8d, (void*)R_R9); break; #endif + case 282: // sys_signalfd + // need to mask SIGSEGV + { + sigset_t * set = (sigset_t *)R_RDX; + if(sigismember(set, SIGSEGV)) { + sigdelset(set, SIGSEGV); + printf_log(LOG_INFO, "Warning, signalfd on SIGSEGV unsuported\n"); + } + return signalfd((int)R_ESI, set, 0); + } + break; case 317: // sys_seccomp return 0; // ignoring call #ifndef __NR_fchmodat4 -- cgit 1.4.1