1 // This file automatically generated by gen_kernel_syscalls_translation.py
2 // DO NOT EDIT!
3
RunGuestSyscallImpl(long guest_nr,long arg_1,long arg_2,long arg_3,long arg_4,long arg_5,long arg_6)4 long RunGuestSyscallImpl(long guest_nr,
5 long arg_1,
6 long arg_2,
7 long arg_3,
8 long arg_4,
9 long arg_5,
10 long arg_6) {
11 switch (guest_nr) {
12 case 202: // __NR_accept
13 return syscall(43, arg_1, arg_2, arg_3);
14 case 242: // __NR_accept4
15 return syscall(288, arg_1, arg_2, arg_3, arg_4);
16 case 89: // __NR_acct
17 return syscall(163, arg_1);
18 case 217: // __NR_add_key
19 return syscall(248, arg_1, arg_2, arg_3, arg_4, arg_5);
20 case 171: // __NR_adjtimex
21 return syscall(159, arg_1);
22 case 200: // __NR_bind
23 return syscall(49, arg_1, arg_2, arg_3);
24 case 280: // __NR_bpf
25 return syscall(321, arg_1, arg_2, arg_3);
26 case 214: // __NR_brk
27 return syscall(12, arg_1);
28 case 90: // __NR_capget
29 return syscall(125, arg_1, arg_2);
30 case 91: // __NR_capset
31 return syscall(126, arg_1, arg_2);
32 case 49: // __NR_chdir
33 return syscall(80, arg_1);
34 case 51: // __NR_chroot
35 return syscall(161, arg_1);
36 case 266: // __NR_clock_adjtime
37 return syscall(305, arg_1, arg_2);
38 case 114: // __NR_clock_getres
39 return syscall(229, arg_1, arg_2);
40 case 113: // __NR_clock_gettime
41 return syscall(228, arg_1, arg_2);
42 case 115: // __NR_clock_nanosleep
43 return syscall(230, arg_1, arg_2, arg_3, arg_4);
44 case 112: // __NR_clock_settime
45 return syscall(227, arg_1, arg_2);
46 case 220: // __NR_clone
47 // custom syscall
48 return RunGuestSyscall___NR_clone(arg_1, arg_2, arg_3, arg_4, arg_5);
49 case 435: // __NR_clone3
50 // custom syscall
51 return RunGuestSyscall___NR_clone3(arg_1, arg_2);
52 case 57: // __NR_close
53 // /proc/self/maps emulation
54 return RunGuestSyscall___NR_close(arg_1);
55 case 436: // __NR_close_range
56 return syscall(436, arg_1, arg_2, arg_3);
57 case 203: // __NR_connect
58 return syscall(42, arg_1, arg_2, arg_3);
59 case 285: // __NR_copy_file_range
60 return syscall(326, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
61 case 106: // __NR_delete_module
62 return syscall(176, arg_1, arg_2);
63 case 23: // __NR_dup
64 return syscall(32, arg_1);
65 case 24: // __NR_dup3
66 return syscall(292, arg_1, arg_2, arg_3);
67 case 20: // __NR_epoll_create1
68 return syscall(291, arg_1);
69 case 21: // __NR_epoll_ctl
70 // incompatible prototype
71 return RunGuestSyscall___NR_epoll_ctl(arg_1, arg_2, arg_3, arg_4);
72 case 22: // __NR_epoll_pwait
73 // incompatible prototype
74 return RunGuestSyscall___NR_epoll_pwait(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
75 case 441: // __NR_epoll_pwait2
76 // incompatible prototype
77 return RunGuestSyscall___NR_epoll_pwait2(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
78 case 19: // __NR_eventfd2
79 return syscall(290, arg_1, arg_2);
80 case 221: // __NR_execve
81 // custom syscall
82 return RunGuestSyscall___NR_execve(arg_1, arg_2, arg_3);
83 case 281: // __NR_execveat
84 // custom syscall
85 return RunGuestSyscall___NR_execveat(arg_1, arg_2, arg_3, arg_4, arg_5);
86 case 93: // __NR_exit
87 // cleans guest thread
88 return RunGuestSyscall___NR_exit(arg_1);
89 case 94: // __NR_exit_group
90 return syscall(231, arg_1);
91 case 48: // __NR_faccessat
92 // follows symlinks
93 return RunGuestSyscall___NR_faccessat(arg_1, arg_2, arg_3);
94 case 439: // __NR_faccessat2
95 return syscall(439, arg_1, arg_2, arg_3, arg_4);
96 case 223: // __NR_fadvise64
97 // sys_fadvise64_64 on riscv64 but sys_fadvise64 on x86_64
98 return RunGuestSyscall___NR_fadvise64(arg_1, arg_2, arg_3, arg_4);
99 case 47: // __NR_fallocate
100 return syscall(285, arg_1, arg_2, arg_3, arg_4);
101 case 262: // __NR_fanotify_init
102 // missing prototype
103 KAPI_TRACE("unsupported syscall __NR_fanotify_init");
104 errno = ENOSYS;
105 return -1;
106 case 263: // __NR_fanotify_mark
107 // missing prototype
108 KAPI_TRACE("unsupported syscall __NR_fanotify_mark");
109 errno = ENOSYS;
110 return -1;
111 case 50: // __NR_fchdir
112 return syscall(81, arg_1);
113 case 52: // __NR_fchmod
114 return syscall(91, arg_1, arg_2);
115 case 53: // __NR_fchmodat
116 return syscall(268, arg_1, arg_2, arg_3);
117 case 55: // __NR_fchown
118 return syscall(93, arg_1, arg_2, arg_3);
119 case 54: // __NR_fchownat
120 return syscall(260, arg_1, arg_2, arg_3, arg_4, arg_5);
121 case 25: // __NR_fcntl
122 // custom syscall
123 return RunGuestSyscall___NR_fcntl(arg_1, arg_2, arg_3);
124 case 83: // __NR_fdatasync
125 return syscall(75, arg_1);
126 case 10: // __NR_fgetxattr
127 return syscall(193, arg_1, arg_2, arg_3, arg_4);
128 case 273: // __NR_finit_module
129 return syscall(313, arg_1, arg_2, arg_3);
130 case 13: // __NR_flistxattr
131 return syscall(196, arg_1, arg_2, arg_3);
132 case 32: // __NR_flock
133 return syscall(73, arg_1, arg_2);
134 case 16: // __NR_fremovexattr
135 return syscall(199, arg_1, arg_2);
136 case 431: // __NR_fsconfig
137 return syscall(431, arg_1, arg_2, arg_3, arg_4, arg_5);
138 case 7: // __NR_fsetxattr
139 return syscall(190, arg_1, arg_2, arg_3, arg_4, arg_5);
140 case 432: // __NR_fsmount
141 return syscall(432, arg_1, arg_2, arg_3);
142 case 430: // __NR_fsopen
143 return syscall(430, arg_1, arg_2);
144 case 433: // __NR_fspick
145 return syscall(433, arg_1, arg_2, arg_3);
146 case 80: // __NR_fstat
147 // incompatible prototype and /proc/self/maps emulation
148 return RunGuestSyscall___NR_fstat(arg_1, arg_2);
149 case 44: // __NR_fstatfs
150 // /proc/self/maps emulation
151 return RunGuestSyscall___NR_fstatfs(arg_1, arg_2);
152 case 82: // __NR_fsync
153 return syscall(74, arg_1);
154 case 46: // __NR_ftruncate
155 return syscall(77, arg_1, arg_2);
156 case 98: // __NR_futex
157 return syscall(202, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
158 case 449: // __NR_futex_waitv
159 return syscall(449, arg_1, arg_2, arg_3, arg_4, arg_5);
160 case 236: // __NR_get_mempolicy
161 // missing prototype
162 KAPI_TRACE("unsupported syscall __NR_get_mempolicy");
163 errno = ENOSYS;
164 return -1;
165 case 100: // __NR_get_robust_list
166 return syscall(274, arg_1, arg_2, arg_3);
167 case 168: // __NR_getcpu
168 return syscall(309, arg_1, arg_2, arg_3);
169 case 17: // __NR_getcwd
170 return syscall(79, arg_1, arg_2);
171 case 61: // __NR_getdents64
172 return syscall(217, arg_1, arg_2, arg_3);
173 case 177: // __NR_getegid
174 return syscall(108);
175 case 175: // __NR_geteuid
176 return syscall(107);
177 case 176: // __NR_getgid
178 return syscall(104);
179 case 158: // __NR_getgroups
180 return syscall(115, arg_1, arg_2);
181 case 102: // __NR_getitimer
182 return syscall(36, arg_1, arg_2);
183 case 205: // __NR_getpeername
184 return syscall(52, arg_1, arg_2, arg_3);
185 case 155: // __NR_getpgid
186 return syscall(121, arg_1);
187 case 172: // __NR_getpid
188 return syscall(39);
189 case 173: // __NR_getppid
190 return syscall(110);
191 case 141: // __NR_getpriority
192 return syscall(140, arg_1, arg_2);
193 case 278: // __NR_getrandom
194 return syscall(318, arg_1, arg_2, arg_3);
195 case 150: // __NR_getresgid
196 return syscall(120, arg_1, arg_2, arg_3);
197 case 148: // __NR_getresuid
198 return syscall(118, arg_1, arg_2, arg_3);
199 case 163: // __NR_getrlimit
200 return syscall(97, arg_1, arg_2);
201 case 165: // __NR_getrusage
202 return syscall(98, arg_1, arg_2);
203 case 156: // __NR_getsid
204 return syscall(124, arg_1);
205 case 204: // __NR_getsockname
206 return syscall(51, arg_1, arg_2, arg_3);
207 case 209: // __NR_getsockopt
208 return syscall(55, arg_1, arg_2, arg_3, arg_4, arg_5);
209 case 178: // __NR_gettid
210 return syscall(186);
211 case 169: // __NR_gettimeofday
212 return syscall(96, arg_1, arg_2);
213 case 174: // __NR_getuid
214 return syscall(102);
215 case 8: // __NR_getxattr
216 return syscall(191, arg_1, arg_2, arg_3, arg_4);
217 case 105: // __NR_init_module
218 return syscall(175, arg_1, arg_2, arg_3);
219 case 27: // __NR_inotify_add_watch
220 return syscall(254, arg_1, arg_2, arg_3);
221 case 26: // __NR_inotify_init1
222 return syscall(294, arg_1);
223 case 28: // __NR_inotify_rm_watch
224 return syscall(255, arg_1, arg_2);
225 case 3: // __NR_io_cancel
226 return syscall(210, arg_1, arg_2, arg_3);
227 case 1: // __NR_io_destroy
228 return syscall(207, arg_1);
229 case 4: // __NR_io_getevents
230 return syscall(208, arg_1, arg_2, arg_3, arg_4, arg_5);
231 case 292: // __NR_io_pgetevents
232 return syscall(333, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
233 case 0: // __NR_io_setup
234 return syscall(206, arg_1, arg_2);
235 case 2: // __NR_io_submit
236 return syscall(209, arg_1, arg_2, arg_3);
237 case 426: // __NR_io_uring_enter
238 return syscall(426, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
239 case 427: // __NR_io_uring_register
240 return syscall(427, arg_1, arg_2, arg_3, arg_4);
241 case 425: // __NR_io_uring_setup
242 return syscall(425, arg_1, arg_2);
243 case 29: // __NR_ioctl
244 // custom syscall
245 return RunGuestSyscall___NR_ioctl(arg_1, arg_2, arg_3);
246 case 31: // __NR_ioprio_get
247 return syscall(252, arg_1, arg_2);
248 case 30: // __NR_ioprio_set
249 return syscall(251, arg_1, arg_2, arg_3);
250 case 272: // __NR_kcmp
251 return syscall(312, arg_1, arg_2, arg_3, arg_4, arg_5);
252 case 294: // __NR_kexec_file_load
253 // missing prototype
254 KAPI_TRACE("unsupported syscall __NR_kexec_file_load");
255 errno = ENOSYS;
256 return -1;
257 case 104: // __NR_kexec_load
258 // missing prototype
259 KAPI_TRACE("unsupported syscall __NR_kexec_load");
260 errno = ENOSYS;
261 return -1;
262 case 219: // __NR_keyctl
263 return syscall(250, arg_1, arg_2, arg_3, arg_4, arg_5);
264 case 129: // __NR_kill
265 return syscall(62, arg_1, arg_2);
266 case 445: // __NR_landlock_add_rule
267 // missing prototype
268 KAPI_TRACE("unsupported syscall __NR_landlock_add_rule");
269 errno = ENOSYS;
270 return -1;
271 case 444: // __NR_landlock_create_ruleset
272 // missing prototype
273 KAPI_TRACE("unsupported syscall __NR_landlock_create_ruleset");
274 errno = ENOSYS;
275 return -1;
276 case 446: // __NR_landlock_restrict_self
277 // missing prototype
278 KAPI_TRACE("unsupported syscall __NR_landlock_restrict_self");
279 errno = ENOSYS;
280 return -1;
281 case 9: // __NR_lgetxattr
282 return syscall(192, arg_1, arg_2, arg_3, arg_4);
283 case 37: // __NR_linkat
284 return syscall(265, arg_1, arg_2, arg_3, arg_4, arg_5);
285 case 201: // __NR_listen
286 return syscall(50, arg_1, arg_2);
287 case 11: // __NR_listxattr
288 return syscall(194, arg_1, arg_2, arg_3);
289 case 12: // __NR_llistxattr
290 return syscall(195, arg_1, arg_2, arg_3);
291 case 18: // __NR_lookup_dcookie
292 return syscall(212, arg_1, arg_2, arg_3);
293 case 15: // __NR_lremovexattr
294 return syscall(198, arg_1, arg_2);
295 case 62: // __NR_lseek
296 return syscall(8, arg_1, arg_2, arg_3);
297 case 6: // __NR_lsetxattr
298 return syscall(189, arg_1, arg_2, arg_3, arg_4, arg_5);
299 case 233: // __NR_madvise
300 return syscall(28, arg_1, arg_2, arg_3);
301 case 235: // __NR_mbind
302 // missing prototype
303 KAPI_TRACE("unsupported syscall __NR_mbind");
304 errno = ENOSYS;
305 return -1;
306 case 283: // __NR_membarrier
307 return syscall(324, arg_1, arg_2, arg_3);
308 case 279: // __NR_memfd_create
309 return syscall(319, arg_1, arg_2);
310 case 447: // __NR_memfd_secret
311 return syscall(447, arg_1);
312 case 238: // __NR_migrate_pages
313 // missing prototype
314 KAPI_TRACE("unsupported syscall __NR_migrate_pages");
315 errno = ENOSYS;
316 return -1;
317 case 232: // __NR_mincore
318 return syscall(27, arg_1, arg_2, arg_3);
319 case 34: // __NR_mkdirat
320 return syscall(258, arg_1, arg_2, arg_3);
321 case 33: // __NR_mknodat
322 return syscall(259, arg_1, arg_2, arg_3, arg_4);
323 case 228: // __NR_mlock
324 return syscall(149, arg_1, arg_2);
325 case 284: // __NR_mlock2
326 return syscall(325, arg_1, arg_2, arg_3);
327 case 230: // __NR_mlockall
328 return syscall(151, arg_1);
329 case 222: // __NR_mmap
330 // changes memory protection
331 return RunGuestSyscall___NR_mmap(arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
332 case 40: // __NR_mount
333 return syscall(165, arg_1, arg_2, arg_3, arg_4, arg_5);
334 case 442: // __NR_mount_setattr
335 return syscall(442, arg_1, arg_2, arg_3, arg_4, arg_5);
336 case 429: // __NR_move_mount
337 return syscall(429, arg_1, arg_2, arg_3, arg_4, arg_5);
338 case 239: // __NR_move_pages
339 // missing prototype
340 KAPI_TRACE("unsupported syscall __NR_move_pages");
341 errno = ENOSYS;
342 return -1;
343 case 226: // __NR_mprotect
344 // changes memory protection
345 return RunGuestSyscall___NR_mprotect(arg_1, arg_2, arg_3);
346 case 185: // __NR_mq_getsetattr
347 // missing prototype
348 KAPI_TRACE("unsupported syscall __NR_mq_getsetattr");
349 errno = ENOSYS;
350 return -1;
351 case 184: // __NR_mq_notify
352 // missing prototype
353 KAPI_TRACE("unsupported syscall __NR_mq_notify");
354 errno = ENOSYS;
355 return -1;
356 case 180: // __NR_mq_open
357 // missing prototype
358 KAPI_TRACE("unsupported syscall __NR_mq_open");
359 errno = ENOSYS;
360 return -1;
361 case 183: // __NR_mq_timedreceive
362 // missing prototype
363 KAPI_TRACE("unsupported syscall __NR_mq_timedreceive");
364 errno = ENOSYS;
365 return -1;
366 case 182: // __NR_mq_timedsend
367 // missing prototype
368 KAPI_TRACE("unsupported syscall __NR_mq_timedsend");
369 errno = ENOSYS;
370 return -1;
371 case 181: // __NR_mq_unlink
372 // missing prototype
373 KAPI_TRACE("unsupported syscall __NR_mq_unlink");
374 errno = ENOSYS;
375 return -1;
376 case 216: // __NR_mremap
377 // changes memory protection
378 return RunGuestSyscall___NR_mremap(arg_1, arg_2, arg_3, arg_4, arg_5);
379 case 187: // __NR_msgctl
380 // missing prototype
381 KAPI_TRACE("unsupported syscall __NR_msgctl");
382 errno = ENOSYS;
383 return -1;
384 case 186: // __NR_msgget
385 // missing prototype
386 KAPI_TRACE("unsupported syscall __NR_msgget");
387 errno = ENOSYS;
388 return -1;
389 case 188: // __NR_msgrcv
390 // missing prototype
391 KAPI_TRACE("unsupported syscall __NR_msgrcv");
392 errno = ENOSYS;
393 return -1;
394 case 189: // __NR_msgsnd
395 // missing prototype
396 KAPI_TRACE("unsupported syscall __NR_msgsnd");
397 errno = ENOSYS;
398 return -1;
399 case 227: // __NR_msync
400 return syscall(26, arg_1, arg_2, arg_3);
401 case 229: // __NR_munlock
402 return syscall(150, arg_1, arg_2);
403 case 231: // __NR_munlockall
404 return syscall(152);
405 case 215: // __NR_munmap
406 // changes memory protection
407 return RunGuestSyscall___NR_munmap(arg_1, arg_2);
408 case 264: // __NR_name_to_handle_at
409 // missing prototype
410 KAPI_TRACE("unsupported syscall __NR_name_to_handle_at");
411 errno = ENOSYS;
412 return -1;
413 case 101: // __NR_nanosleep
414 return syscall(35, arg_1, arg_2);
415 case 79: // __NR_newfstatat
416 // follows symlinks
417 return RunGuestSyscall___NR_newfstatat(arg_1, arg_2, arg_3, arg_4);
418 case 42: // __NR_nfsservctl
419 return syscall(180);
420 case 265: // __NR_open_by_handle_at
421 // missing prototype
422 KAPI_TRACE("unsupported syscall __NR_open_by_handle_at");
423 errno = ENOSYS;
424 return -1;
425 case 428: // __NR_open_tree
426 return syscall(428, arg_1, arg_2, arg_3);
427 case 56: // __NR_openat
428 // follows symlinks, open flags value mismatch
429 return RunGuestSyscall___NR_openat(arg_1, arg_2, arg_3, arg_4);
430 case 437: // __NR_openat2
431 return syscall(437, arg_1, arg_2, arg_3, arg_4);
432 case 241: // __NR_perf_event_open
433 return syscall(298, arg_1, arg_2, arg_3, arg_4, arg_5);
434 case 92: // __NR_personality
435 return syscall(135, arg_1);
436 case 438: // __NR_pidfd_getfd
437 return syscall(438, arg_1, arg_2, arg_3);
438 case 434: // __NR_pidfd_open
439 return syscall(434, arg_1, arg_2);
440 case 424: // __NR_pidfd_send_signal
441 return syscall(424, arg_1, arg_2, arg_3, arg_4);
442 case 59: // __NR_pipe2
443 return syscall(293, arg_1, arg_2);
444 case 41: // __NR_pivot_root
445 return syscall(155, arg_1, arg_2);
446 case 289: // __NR_pkey_alloc
447 // missing prototype
448 KAPI_TRACE("unsupported syscall __NR_pkey_alloc");
449 errno = ENOSYS;
450 return -1;
451 case 290: // __NR_pkey_free
452 // missing prototype
453 KAPI_TRACE("unsupported syscall __NR_pkey_free");
454 errno = ENOSYS;
455 return -1;
456 case 288: // __NR_pkey_mprotect
457 // missing prototype
458 KAPI_TRACE("unsupported syscall __NR_pkey_mprotect");
459 errno = ENOSYS;
460 return -1;
461 case 73: // __NR_ppoll
462 return syscall(271, arg_1, arg_2, arg_3, arg_4, arg_5);
463 case 167: // __NR_prctl
464 // custom syscall
465 return RunGuestSyscall___NR_prctl(arg_1, arg_2, arg_3, arg_4, arg_5);
466 case 67: // __NR_pread64
467 return syscall(17, arg_1, arg_2, arg_3, arg_4);
468 case 69: // __NR_preadv
469 return syscall(295, arg_1, arg_2, arg_3, arg_4, arg_5);
470 case 286: // __NR_preadv2
471 return syscall(327, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
472 case 261: // __NR_prlimit64
473 return syscall(302, arg_1, arg_2, arg_3, arg_4);
474 case 440: // __NR_process_madvise
475 return syscall(440, arg_1, arg_2, arg_3, arg_4, arg_5);
476 case 448: // __NR_process_mrelease
477 return syscall(448, arg_1, arg_2);
478 case 270: // __NR_process_vm_readv
479 return syscall(310, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
480 case 271: // __NR_process_vm_writev
481 return syscall(311, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
482 case 72: // __NR_pselect6
483 return syscall(270, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
484 case 117: // __NR_ptrace
485 // custom syscall
486 return RunGuestSyscall___NR_ptrace(arg_1, arg_2, arg_3, arg_4);
487 case 68: // __NR_pwrite64
488 return syscall(18, arg_1, arg_2, arg_3, arg_4);
489 case 70: // __NR_pwritev
490 return syscall(296, arg_1, arg_2, arg_3, arg_4, arg_5);
491 case 287: // __NR_pwritev2
492 return syscall(328, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
493 case 60: // __NR_quotactl
494 return syscall(179, arg_1, arg_2, arg_3, arg_4);
495 case 443: // __NR_quotactl_fd
496 return syscall(443, arg_1, arg_2, arg_3, arg_4);
497 case 63: // __NR_read
498 return syscall(0, arg_1, arg_2, arg_3);
499 case 213: // __NR_readahead
500 return syscall(187, arg_1, arg_2, arg_3);
501 case 78: // __NR_readlinkat
502 // follows symlinks
503 return RunGuestSyscall___NR_readlinkat(arg_1, arg_2, arg_3, arg_4);
504 case 65: // __NR_readv
505 return syscall(19, arg_1, arg_2, arg_3);
506 case 142: // __NR_reboot
507 return syscall(169, arg_1, arg_2, arg_3, arg_4);
508 case 207: // __NR_recvfrom
509 return syscall(45, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
510 case 243: // __NR_recvmmsg
511 return syscall(299, arg_1, arg_2, arg_3, arg_4, arg_5);
512 case 212: // __NR_recvmsg
513 return syscall(47, arg_1, arg_2, arg_3);
514 case 234: // __NR_remap_file_pages
515 return syscall(216, arg_1, arg_2, arg_3, arg_4, arg_5);
516 case 14: // __NR_removexattr
517 return syscall(197, arg_1, arg_2);
518 case 38: // __NR_renameat
519 return syscall(264, arg_1, arg_2, arg_3, arg_4);
520 case 276: // __NR_renameat2
521 return syscall(316, arg_1, arg_2, arg_3, arg_4, arg_5);
522 case 218: // __NR_request_key
523 return syscall(249, arg_1, arg_2, arg_3, arg_4);
524 case 128: // __NR_restart_syscall
525 return syscall(219);
526 case 259: // __NR_riscv_flush_icache
527 // missing on x86_64
528 return RunGuestSyscall___NR_riscv_flush_icache(arg_1, arg_2, arg_3);
529 case 258: // __NR_riscv_hwprobe
530 // missing on x86_64
531 return RunGuestSyscall___NR_riscv_hwprobe(arg_1, arg_2, arg_3, arg_4, arg_5);
532 case 293: // __NR_rseq
533 // missing prototype
534 KAPI_TRACE("unsupported syscall __NR_rseq");
535 errno = ENOSYS;
536 return -1;
537 case 134: // __NR_rt_sigaction
538 // changes signal action
539 return RunGuestSyscall___NR_rt_sigaction(arg_1, arg_2, arg_3, arg_4);
540 case 136: // __NR_rt_sigpending
541 return syscall(127, arg_1, arg_2);
542 case 135: // __NR_rt_sigprocmask
543 return syscall(14, arg_1, arg_2, arg_3, arg_4);
544 case 138: // __NR_rt_sigqueueinfo
545 return syscall(129, arg_1, arg_2, arg_3);
546 case 139: // __NR_rt_sigreturn
547 // should never be called from guest
548 return RunGuestSyscall___NR_rt_sigreturn(arg_1);
549 case 133: // __NR_rt_sigsuspend
550 return syscall(130, arg_1, arg_2);
551 case 137: // __NR_rt_sigtimedwait
552 return syscall(128, arg_1, arg_2, arg_3, arg_4);
553 case 240: // __NR_rt_tgsigqueueinfo
554 return syscall(297, arg_1, arg_2, arg_3, arg_4);
555 case 125: // __NR_sched_get_priority_max
556 return syscall(146, arg_1);
557 case 126: // __NR_sched_get_priority_min
558 return syscall(147, arg_1);
559 case 123: // __NR_sched_getaffinity
560 return syscall(204, arg_1, arg_2, arg_3);
561 case 275: // __NR_sched_getattr
562 return syscall(315, arg_1, arg_2, arg_3, arg_4);
563 case 121: // __NR_sched_getparam
564 return syscall(143, arg_1, arg_2);
565 case 120: // __NR_sched_getscheduler
566 return syscall(145, arg_1);
567 case 127: // __NR_sched_rr_get_interval
568 return syscall(148, arg_1, arg_2);
569 case 122: // __NR_sched_setaffinity
570 return syscall(203, arg_1, arg_2, arg_3);
571 case 274: // __NR_sched_setattr
572 return syscall(314, arg_1, arg_2, arg_3);
573 case 118: // __NR_sched_setparam
574 return syscall(142, arg_1, arg_2);
575 case 119: // __NR_sched_setscheduler
576 return syscall(144, arg_1, arg_2, arg_3);
577 case 124: // __NR_sched_yield
578 return syscall(24);
579 case 277: // __NR_seccomp
580 return syscall(317, arg_1, arg_2, arg_3);
581 case 191: // __NR_semctl
582 // missing prototype
583 KAPI_TRACE("unsupported syscall __NR_semctl");
584 errno = ENOSYS;
585 return -1;
586 case 190: // __NR_semget
587 // missing prototype
588 KAPI_TRACE("unsupported syscall __NR_semget");
589 errno = ENOSYS;
590 return -1;
591 case 193: // __NR_semop
592 // missing prototype
593 KAPI_TRACE("unsupported syscall __NR_semop");
594 errno = ENOSYS;
595 return -1;
596 case 192: // __NR_semtimedop
597 // missing prototype
598 KAPI_TRACE("unsupported syscall __NR_semtimedop");
599 errno = ENOSYS;
600 return -1;
601 case 71: // __NR_sendfile
602 return syscall(40, arg_1, arg_2, arg_3, arg_4);
603 case 269: // __NR_sendmmsg
604 return syscall(307, arg_1, arg_2, arg_3, arg_4);
605 case 211: // __NR_sendmsg
606 return syscall(46, arg_1, arg_2, arg_3);
607 case 206: // __NR_sendto
608 return syscall(44, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
609 case 237: // __NR_set_mempolicy
610 // missing prototype
611 KAPI_TRACE("unsupported syscall __NR_set_mempolicy");
612 errno = ENOSYS;
613 return -1;
614 case 450: // __NR_set_mempolicy_home_node
615 // missing prototype
616 KAPI_TRACE("unsupported syscall __NR_set_mempolicy_home_node");
617 errno = ENOSYS;
618 return -1;
619 case 99: // __NR_set_robust_list
620 return syscall(273, arg_1, arg_2);
621 case 96: // __NR_set_tid_address
622 return syscall(218, arg_1);
623 case 162: // __NR_setdomainname
624 return syscall(171, arg_1, arg_2);
625 case 152: // __NR_setfsgid
626 return syscall(123, arg_1);
627 case 151: // __NR_setfsuid
628 return syscall(122, arg_1);
629 case 144: // __NR_setgid
630 return syscall(106, arg_1);
631 case 159: // __NR_setgroups
632 return syscall(116, arg_1, arg_2);
633 case 161: // __NR_sethostname
634 return syscall(170, arg_1, arg_2);
635 case 103: // __NR_setitimer
636 return syscall(38, arg_1, arg_2, arg_3);
637 case 268: // __NR_setns
638 return syscall(308, arg_1, arg_2);
639 case 154: // __NR_setpgid
640 return syscall(109, arg_1, arg_2);
641 case 140: // __NR_setpriority
642 return syscall(141, arg_1, arg_2, arg_3);
643 case 143: // __NR_setregid
644 return syscall(114, arg_1, arg_2);
645 case 149: // __NR_setresgid
646 return syscall(119, arg_1, arg_2, arg_3);
647 case 147: // __NR_setresuid
648 return syscall(117, arg_1, arg_2, arg_3);
649 case 145: // __NR_setreuid
650 return syscall(113, arg_1, arg_2);
651 case 164: // __NR_setrlimit
652 return syscall(160, arg_1, arg_2);
653 case 157: // __NR_setsid
654 return syscall(112);
655 case 208: // __NR_setsockopt
656 return syscall(54, arg_1, arg_2, arg_3, arg_4, arg_5);
657 case 170: // __NR_settimeofday
658 return syscall(164, arg_1, arg_2);
659 case 146: // __NR_setuid
660 return syscall(105, arg_1);
661 case 5: // __NR_setxattr
662 return syscall(188, arg_1, arg_2, arg_3, arg_4, arg_5);
663 case 196: // __NR_shmat
664 // missing prototype
665 KAPI_TRACE("unsupported syscall __NR_shmat");
666 errno = ENOSYS;
667 return -1;
668 case 195: // __NR_shmctl
669 // missing prototype
670 KAPI_TRACE("unsupported syscall __NR_shmctl");
671 errno = ENOSYS;
672 return -1;
673 case 197: // __NR_shmdt
674 // missing prototype
675 KAPI_TRACE("unsupported syscall __NR_shmdt");
676 errno = ENOSYS;
677 return -1;
678 case 194: // __NR_shmget
679 // missing prototype
680 KAPI_TRACE("unsupported syscall __NR_shmget");
681 errno = ENOSYS;
682 return -1;
683 case 210: // __NR_shutdown
684 return syscall(48, arg_1, arg_2);
685 case 132: // __NR_sigaltstack
686 // changes signal stack
687 return RunGuestSyscall___NR_sigaltstack(arg_1, arg_2);
688 case 74: // __NR_signalfd4
689 return syscall(289, arg_1, arg_2, arg_3, arg_4);
690 case 198: // __NR_socket
691 return syscall(41, arg_1, arg_2, arg_3);
692 case 199: // __NR_socketpair
693 return syscall(53, arg_1, arg_2, arg_3, arg_4);
694 case 76: // __NR_splice
695 return syscall(275, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
696 case 43: // __NR_statfs
697 return syscall(137, arg_1, arg_2);
698 case 291: // __NR_statx
699 // follows symlinks
700 return RunGuestSyscall___NR_statx(arg_1, arg_2, arg_3, arg_4, arg_5);
701 case 225: // __NR_swapoff
702 return syscall(168, arg_1);
703 case 224: // __NR_swapon
704 return syscall(167, arg_1, arg_2);
705 case 36: // __NR_symlinkat
706 return syscall(266, arg_1, arg_2, arg_3);
707 case 81: // __NR_sync
708 return syscall(162);
709 case 84: // __NR_sync_file_range
710 return syscall(277, arg_1, arg_2, arg_3, arg_4);
711 case 267: // __NR_syncfs
712 return syscall(306, arg_1);
713 case 179: // __NR_sysinfo
714 return syscall(99, arg_1);
715 case 116: // __NR_syslog
716 return syscall(103, arg_1, arg_2, arg_3);
717 case 77: // __NR_tee
718 return syscall(276, arg_1, arg_2, arg_3, arg_4);
719 case 131: // __NR_tgkill
720 return syscall(234, arg_1, arg_2, arg_3);
721 case 107: // __NR_timer_create
722 // incompatible prototype
723 return RunGuestSyscall___NR_timer_create(arg_1, arg_2, arg_3);
724 case 111: // __NR_timer_delete
725 return syscall(226, arg_1);
726 case 109: // __NR_timer_getoverrun
727 return syscall(225, arg_1);
728 case 108: // __NR_timer_gettime
729 return syscall(224, arg_1, arg_2);
730 case 110: // __NR_timer_settime
731 return syscall(223, arg_1, arg_2, arg_3, arg_4);
732 case 85: // __NR_timerfd_create
733 return syscall(283, arg_1, arg_2);
734 case 87: // __NR_timerfd_gettime
735 return syscall(287, arg_1, arg_2);
736 case 86: // __NR_timerfd_settime
737 return syscall(286, arg_1, arg_2, arg_3, arg_4);
738 case 153: // __NR_times
739 return syscall(100, arg_1);
740 case 130: // __NR_tkill
741 return syscall(200, arg_1, arg_2);
742 case 45: // __NR_truncate
743 return syscall(76, arg_1, arg_2);
744 case 166: // __NR_umask
745 return syscall(95, arg_1);
746 case 39: // __NR_umount2
747 return syscall(166, arg_1, arg_2);
748 case 160: // __NR_uname
749 return syscall(63, arg_1);
750 case 35: // __NR_unlinkat
751 return syscall(263, arg_1, arg_2, arg_3);
752 case 97: // __NR_unshare
753 return syscall(272, arg_1);
754 case 282: // __NR_userfaultfd
755 return syscall(323, arg_1);
756 case 88: // __NR_utimensat
757 return syscall(280, arg_1, arg_2, arg_3, arg_4);
758 case 58: // __NR_vhangup
759 return syscall(153);
760 case 75: // __NR_vmsplice
761 return syscall(278, arg_1, arg_2, arg_3, arg_4);
762 case 260: // __NR_wait4
763 return syscall(61, arg_1, arg_2, arg_3, arg_4);
764 case 95: // __NR_waitid
765 return syscall(247, arg_1, arg_2, arg_3, arg_4, arg_5);
766 case 64: // __NR_write
767 return syscall(1, arg_1, arg_2, arg_3);
768 case 66: // __NR_writev
769 return syscall(20, arg_1, arg_2, arg_3);
770 default:
771 return RunUnknownGuestSyscall(guest_nr, arg_1, arg_2, arg_3, arg_4, arg_5, arg_6);
772 }
773 }
774