Skip to content

Commit 042895a

Browse files
committed
Wasm: add __syscall implementation for the sake of __syscall_cp
1 parent d10e141 commit 042895a

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/internal/wasm/syscall.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <stdarg.h>
2+
#include "syscall.h"
3+
4+
/* This is hardly required at all... in all but one place in the
5+
* Musl codebase, the __syscall macro is able to redirect to
6+
* __syscallN directly, but in __syscall_cp there's an exception
7+
* where the varargs version is called explicitly. We therefore
8+
* need this extra stub.
9+
*
10+
* TODO See if we can get __syscall_cp to be changed, or move this
11+
* stub into src/internal/syscall.c so it's not necessary to do
12+
* this in the Wasm arch code.
13+
*/
14+
long (__syscall)(long n, ...)
15+
{
16+
va_list va;
17+
va_start(va, n);
18+
long a1 = va_arg(va, long);
19+
long a2 = va_arg(va, long);
20+
long a3 = va_arg(va, long);
21+
long a4 = va_arg(va, long);
22+
long a5 = va_arg(va, long);
23+
long a6 = va_arg(va, long);
24+
return __syscall6(n, a1, a2, a3, a4, a5, a6);
25+
}

0 commit comments

Comments
 (0)