Skip to content

Commit 8b4c9b3

Browse files
committed
Even more syscalls
1 parent b7d4325 commit 8b4c9b3

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

src/emu/x64syscall.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ static const scwrap_t syscallwrap[] = {
129129
#ifdef __NR_dup2
130130
[33] = {__NR_dup2, 2},
131131
#endif
132+
#ifdef __NR_pause
133+
[34] = {__NR_pause, 0},
134+
#endif
132135
[35] = {__NR_nanosleep, 2},
133136
[38] = {__NR_setitimer, 3},
134137
[39] = {__NR_getpid, 0},
@@ -659,6 +662,13 @@ void EXPORT x64Syscall_linux(x64emu_t *emu)
659662
S_RAX = -errno;
660663
break;
661664
#endif
665+
#ifndef __NR_pause
666+
case 34: // sys_pause
667+
S_RAX = pause();
668+
if(S_RAX==-1)
669+
S_RAX = -errno;
670+
break;
671+
#endif
662672
case 56: // sys_clone
663673
// x86_64 raw syscall is long clone(unsigned long flags, void *stack, int *parent_tid, int *child_tid, unsigned long tls);
664674
// so flags=R_RDI, stack=R_RSI, parent_tid=R_RDX, child_tid=R_R10, tls=R_R8
@@ -1067,6 +1077,14 @@ long EXPORT my_syscall(x64emu_t *emu)
10671077
#endif
10681078
case 25: // sys_mremap
10691079
return (intptr_t)my_mremap(emu, (void*)R_RSI, R_RDX, R_RCX, R_R8d, (void*)R_R9);
1080+
#ifndef __NR_dup2
1081+
case 33:
1082+
return dup2(S_ESI, S_EDX);
1083+
#endif
1084+
#ifndef __NR_pause
1085+
case 34:
1086+
return pause();
1087+
#endif
10701088
case 56: // sys_clone
10711089
// x86_64 raw syscall is long clone(unsigned long flags, void *stack, int *parent_tid, int *child_tid, unsigned long tls);
10721090
// so flags=R_RSI, stack=R_RDX, parent_tid=R_RCX, child_tid=R_R8, tls=R_R9
@@ -1116,10 +1134,6 @@ long EXPORT my_syscall(x64emu_t *emu)
11161134
return syscall(__NR_clone, R_RSI, R_RDX, R_RCX, R_R9, R_R8); // invert R_R8/R_R9 on Aarch64 and most other
11171135
#endif
11181136
break;
1119-
#ifndef __NR_dup2
1120-
case 33:
1121-
return dup2(S_ESI, S_EDX);
1122-
#endif
11231137
#ifndef __NR_fork
11241138
case 57:
11251139
return fork();

0 commit comments

Comments
 (0)