about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <seebastien.chev@gmail.com>2023-09-09 14:20:09 +0200
committerptitSeb <seebastien.chev@gmail.com>2023-09-09 14:20:09 +0200
commitd1e8bcd7a5bb11e6bbfa57e7dae29d9dd896104c (patch)
tree912bbe864922483f9cb56585b2eaf7a2dcc70599 /src
parent79c71bf5c1f74bca88b351a614c6271307060a4e (diff)
downloadbox64-d1e8bcd7a5bb11e6bbfa57e7dae29d9dd896104c.tar.gz
box64-d1e8bcd7a5bb11e6bbfa57e7dae29d9dd896104c.zip
Added syscall 282 (for #965)
Diffstat (limited to 'src')
-rw-r--r--src/emu/x64syscall.c26
1 files changed, 26 insertions, 0 deletions
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 <string.h>
 
 #include <sys/syscall.h>   /* For SYS_xxx definitions */
+#include <sys/signalfd.h>
 #include <unistd.h>
 #include <time.h>
 #include <sys/mman.h>
@@ -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