steroid 0.5.0

A lightweight framework for dynamic binary instrumentation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
//! The syscall module contains functions to execute system calls in the target process.
//!
//! Every function in this module is a helper function that aims at running a system call in the
//! target process context. Given a [`TargetController`] and the arguments needed by the system call,
//! steroid instruments the target process to execute the system call and give back the control to
//! the steroid client. The registers are saved at the beginning of the procedure and restored
//! before returning. Consequently, the instruction pointer remains the same at the end of
//! remote-syscall execution, allowing the client to resume the target process' execution.
//!
//! ```no_run
//! use steroid::error::CouldNotResume;
//! use steroid::process::{TargetController, TargetProcess};
//! use steroid::syscall;
//!
//! fn exit_process(mut ctrl: TargetController<TargetProcess>, exit_code: u64)
//! -> Result<(), CouldNotResume> {
//!     // The syscall 'exit' does not return anything so the return value should be ignored.
//!     syscall::exit(&mut ctrl, 0).map( |_void| () )
//! }
//! ```
//!
//! [`TargetController`]: ../process/struct.TargetController.html

use nix::libc::user_regs_struct;

use crate::error::CouldNotResume;
use crate::process::TargetController;
use crate::run::Executing;

/// Execute a syscall instruction within the target process using the given registers. The
/// instruction pointer is reset at the end of this function. The return value of the syscall is
/// returned.
fn call_remote_syscall<E>(
    ctrl: &mut TargetController<E>,
    regs: user_regs_struct,
) -> Result<u64, CouldNotResume>
where
    E: Executing,
{
    let rip = regs.rip as usize;

    let save = ctrl.read(rip, 2)?;
    ctrl.write(rip, &[0x0f, 0x05])?; // syscall instruction.

    ctrl.blind_singlestep()?;

    let rax = ctrl.get_registers()?.rax;

    ctrl.write(rip, &save)?;
    Ok(rax)
}

macro_rules! define_syscall {
    (
        $(#[$outer: meta])*
        $name: ident ($code: expr, $($reg: ident: $arg: ident),* )
    ) => {
        $(#[$outer])*
        pub fn $name<E>(
	    ctrl: &mut TargetController<E>,
	    $($arg: u64),*
	) -> Result<u64, CouldNotResume>
	where
	    E: Executing,
	{
            crate::with_registers!(
                ctrl,
                rax: $code, $($reg: $arg),*;
                call_remote_syscall)
        }
    }
}

define_syscall! {
    /// Call the [`read`] system call in the target process.
    ///
    /// [`read`]: https://man7.org/linux/man-pages/man2/read.2.html
    read(0, rdi: fd, rsi: buf, rdx: count)
}

define_syscall! {
    /// Call the [`write`] system call in the target process.
    ///
    /// [`write`]: https://man7.org/linux/man-pages/man2/write.2.html
    write(1, rdi: fd, rsi: buf, rdx: count)
}

define_syscall! {
    /// Call the [`open`] system call in the target process.
    ///
    /// [`open`]: https://man7.org/linux/man-pages/man2/open.2.html
    open(2, rdi: filename, rsi: flags, rdx: mode)
}

define_syscall! {
    /// Call the [`close`] system call in the target process.
    ///
    /// [`close`]: https://man7.org/linux/man-pages/man2/close.2.html
    close(3, rdi: fd)
}

define_syscall! {
    /// Call the [`stat`] system call in the target process.
    ///
    /// [`stat`]: https://man7.org/linux/man-pages/man2/stat.2.html
    stat(4, rdi: filename, rsi: statbuf)
}

define_syscall! {
    /// Call the [`fstat`] system call in the target process.
    ///
    /// [`fstat`]: https://man7.org/linux/man-pages/man2/fstat.2.html
    fstat(5, rdi: fd, rsi: statbuf)
}

define_syscall! {
    /// Call the [`lstat`] system call in the target process.
    ///
    /// [`lstat`]: https://man7.org/linux/man-pages/man2/lstat.2.html
    lstat(6, rdi: filename, rsi: statbuf)
}

define_syscall! {
    /// Call the [`poll`] system call in the target process.
    ///
    /// [`poll`]: https://man7.org/linux/man-pages/man2/poll.2.html
    poll(7, rdi: ufds, rsi: nfds, rdx: timeout_msecs)
}

define_syscall! {
    /// Call the [`lseek`] system call in the target process.
    ///
    /// [`lseek`]: https://man7.org/linux/man-pages/man2/lseek.2.html
    lseek(8, rdi: fd, rsi: offset, rdx: whence)
}

define_syscall! {
    /// Call the [`mmap`] system call in the target process.
    ///
    /// [`mmap`]: https://man7.org/linux/man-pages/man2/mmap.2.html
    mmap(9, rdi: addr, rsi: len, rdx: prot, r10: flags, r8: fd, r9: off)
}

define_syscall! {
    /// Call the [`mprotect`] system call in the target process.
    ///
    /// [`mprotect`]: https://man7.org/linux/man-pages/man2/mprotect.2.html
    mprotect(10, rdi: start, rsi: len, rdx: prot)
}

define_syscall! {
    /// Call the [`munmap`] system call in the target process.
    ///
    /// [`munmap`]: https://man7.org/linux/man-pages/man2/munmap.2.html
    munmap(11, rdi: addr, rsi: len)
}

define_syscall! {
    /// Call the [`brk`] system call in the target process.
    ///
    /// [`brk`]: https://man7.org/linux/man-pages/man2/brk.2.html
    brk(12, rdi: brk)
}

define_syscall! {
    /// Call the [`rt_sigaction`] system call in the target process.
    ///
    /// [`rt_sigaction`]: https://man7.org/linux/man-pages/man2/rt_sigaction.2.html
    rt_sigaction(13, rdi: sig, rsi: act, rdx: oact, r10: sigsetsize)
}

define_syscall! {
    /// Call the [`rt_sigprocmask`] system call in the target process.
    ///
    /// [`rt_sigprocmask`]: https://man7.org/linux/man-pages/man2/rt_sigprocmask.2.html
    rt_sigprocmask(14, rdi: how, rsi: nset, rdx: oset, r10: sigsetsize)
}

define_syscall! {
    /// Call the [`pread64`] system call in the target process.
    ///
    /// [`pread64`]: https://man7.org/linux/man-pages/man2/pread64.2.html
    pread64(17, rdi: fd, rsi: buf, rdx: count, r10: pos)
}

define_syscall! {
    /// Call the [`pwrite64`] system call in the target process.
    ///
    /// [`pwrite64`]: https://man7.org/linux/man-pages/man2/pwrite64.2.html
    pwrite64(18, rdi: fd, rsi: buf, rdx: count, r10: pos)
}

define_syscall! {
    /// Call the [`readv`] system call in the target process.
    ///
    /// [`readv`]: https://man7.org/linux/man-pages/man2/readv.2.html
    readv(19, rdi: fd, rsi: vec, rdx: vlen)
}

define_syscall! {
    /// Call the [`writev`] system call in the target process.
    ///
    /// [`writev`]: https://man7.org/linux/man-pages/man2/writev.2.html
    writev(20, rdi: fd, rsi: vec, rdx: vlen)
}

define_syscall! {
    /// Call the [`access`] system call in the target process.
    ///
    /// [`access`]: https://man7.org/linux/man-pages/man2/access.2.html
    access(21, rdi: filename, rsi: mode)
}

define_syscall! {
    /// Call the [`pipe`] system call in the target process.
    ///
    /// [`pipe`]: https://man7.org/linux/man-pages/man2/pipe.2.html
    pipe(22, rdi: fildes)
}

define_syscall! {
    /// Call the [`select`] system call in the target process.
    ///
    /// [`select`]: https://man7.org/linux/man-pages/man2/select.2.html
    select(23, rdi: n, rsi: inp, rdx: outp, r10: exp, r8: tvp)
}

define_syscall! {
    /// Call the [`msync`] system call in the target process.
    ///
    /// [`msync`]: https://man7.org/linux/man-pages/man2/msync.2.html
    msync(26, rdi: start, rsi: len, rdx: flags)
}

define_syscall! {
    /// Call the [`mincore`] system call in the target process.
    ///
    /// [`mincore`]: https://man7.org/linux/man-pages/man2/mincore.2.html
    mincore(27, rdi: start, rsi: len, rdx: vec)
}

define_syscall! {
    /// Call the [`madvise`] system call in the target process.
    ///
    /// [`madvise`]: https://man7.org/linux/man-pages/man2/madvise.2.html
    madvise(28, rdi: start, rsi: len_in, rdx: behavior)
}

define_syscall! {
    /// Call the [`shmget`] system call in the target process.
    ///
    /// [`shmget`]: https://man7.org/linux/man-pages/man2/shmget.2.html
    shmget(29, rdi: key, rsi: size, rdx: shmflg)
}

define_syscall! {
    /// Call the [`shmat`] system call in the target process.
    ///
    /// [`shmat`]: https://man7.org/linux/man-pages/man2/shmat.2.html
    shmat(30, rdi: shmid, rsi: shmaddr, rdx: shmflg)
}

define_syscall! {
    /// Call the [`shmctl`] system call in the target process.
    ///
    /// [`shmctl`]: https://man7.org/linux/man-pages/man2/shmctl.2.html
    shmctl(31, rdi: shmid, rsi: cmd, rdx: buf)
}

define_syscall! {
    /// Call the [`dup`] system call in the target process.
    ///
    /// [`dup`]: https://man7.org/linux/man-pages/man2/dup.2.html
    dup(32, rdi: fildes)
}

define_syscall! {
    /// Call the [`dup2`] system call in the target process.
    ///
    /// [`dup2`]: https://man7.org/linux/man-pages/man2/dup2.2.html
    dup2(33, rdi: oldfd, rsi: newfd)
}

define_syscall! {
    /// Call the [`getitimer`] system call in the target process.
    ///
    /// [`getitimer`]: https://man7.org/linux/man-pages/man2/getitimer.2.html
    getitimer(36, rdi: which, rsi: value)
}

define_syscall! {
    /// Call the [`alarm`] system call in the target process.
    ///
    /// [`alarm`]: https://man7.org/linux/man-pages/man2/alarm.2.html
    alarm(37, rdi: seconds)
}

define_syscall! {
    /// Call the [`setitimer`] system call in the target process.
    ///
    /// [`setitimer`]: https://man7.org/linux/man-pages/man2/setitimer.2.html
    setitimer(38, rdi: which, rsi: value, rdx: ovalue)
}

define_syscall! {
    /// Call the [`socket`] system call in the target process.
    ///
    /// [`socket`]: https://man7.org/linux/man-pages/man2/socket.2.html
    socket(41, rdi: family, rsi: type_, rdx: protocol)
}

define_syscall! {
    /// Call the [`connect`] system call in the target process.
    ///
    /// [`connect`]: https://man7.org/linux/man-pages/man2/connect.2.html
    connect(42, rdi: fd, rsi: uservaddr, rdx: addrlen)
}

define_syscall! {
    /// Call the [`accept`] system call in the target process.
    ///
    /// [`accept`]: https://man7.org/linux/man-pages/man2/accept.2.html
    accept(43, rdi: fd, rsi: upeer_sockaddr, rdx: upeer_addrlen)
}

define_syscall! {
    /// Call the [`sendto`] system call in the target process.
    ///
    /// [`sendto`]: https://man7.org/linux/man-pages/man2/sendto.2.html
    sendto(44, rdi: fd, rsi: buff, rdx: len, r10: flags, r8: addr, r9: addr_len)
}

define_syscall! {
    /// Call the [`recvfrom`] system call in the target process.
    ///
    /// [`recvfrom`]: https://man7.org/linux/man-pages/man2/recvfrom.2.html
    recvfrom(45, rdi: fd, rsi: ubuf, rdx: size, r10: flags, r8: addr, r9: addr_len)
}

define_syscall! {
    /// Call the [`sendmsg`] system call in the target process.
    ///
    /// [`sendmsg`]: https://man7.org/linux/man-pages/man2/sendmsg.2.html
    sendmsg(46, rdi: fd, rsi: msg, rdx: flags)
}

define_syscall! {
    /// Call the [`recvmsg`] system call in the target process.
    ///
    /// [`recvmsg`]: https://man7.org/linux/man-pages/man2/recvmsg.2.html
    recvmsg(47, rdi: fd, rsi: msg, rdx: flags)
}

define_syscall! {
    /// Call the [`shutdown`] system call in the target process.
    ///
    /// [`shutdown`]: https://man7.org/linux/man-pages/man2/shutdown.2.html
    shutdown(48, rdi: fd, rsi: how)
}

define_syscall! {
    /// Call the [`bind`] system call in the target process.
    ///
    /// [`bind`]: https://man7.org/linux/man-pages/man2/bind.2.html
    bind(49, rdi: fd, rsi: umyaddr, rdx: addrlen)
}

define_syscall! {
    /// Call the [`listen`] system call in the target process.
    ///
    /// [`listen`]: https://man7.org/linux/man-pages/man2/listen.2.html
    listen(50, rdi: fd, rsi: backlog)
}

define_syscall! {
    /// Call the [`getsockname`] system call in the target process.
    ///
    /// [`getsockname`]: https://man7.org/linux/man-pages/man2/getsockname.2.html
    getsockname(51, rdi: fd, rsi: usockaddr, rdx: usockaddr_len)
}

define_syscall! {
    /// Call the [`getpeername`] system call in the target process.
    ///
    /// [`getpeername`]: https://man7.org/linux/man-pages/man2/getpeername.2.html
    getpeername(52, rdi: fd, rsi: usockaddr, rdx: usockaddr_len)
}

define_syscall! {
    /// Call the [`socketpair`] system call in the target process.
    ///
    /// [`socketpair`]: https://man7.org/linux/man-pages/man2/socketpair.2.html
    socketpair(53, rdi: family, rsi: type_, rdx: protocol, r10: usockvec)
}

define_syscall! {
    /// Call the [`setsockopt`] system call in the target process.
    ///
    /// [`setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
    setsockopt(54, rdi: fd, rsi: level, rdx: optname, r10: optval, r8: optlen)
}

define_syscall! {
    /// Call the [`getsockopt`] system call in the target process.
    ///
    /// [`getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
    getsockopt(55, rdi: fd, rsi: level, rdx: optname, r10: optval, r8: optlen)
}

define_syscall! {
    /// Call the [`clone`] system call in the target process.
    ///
    /// [`clone`]: https://man7.org/linux/man-pages/man2/clone.2.html
    clone(56, rdi: clone_flags, rsi: newsp, rdx: parent_tidptr, r10: child_tidptr, r8: tls_val)
}

define_syscall! {
    /// Call the [`execve`] system call in the target process.
    ///
    /// [`execve`]: https://man7.org/linux/man-pages/man2/execve.2.html
    execve(59, rdi: filename, rsi: argv, rdx: envp)
}

define_syscall! {
    /// Call the [`exit`] system call in the target process.
    ///
    /// [`exit`]: https://man7.org/linux/man-pages/man2/exit.2.html
    exit(60, rdi: error_code)
}

define_syscall! {
    /// Call the [`wait4`] system call in the target process.
    ///
    /// [`wait4`]: https://man7.org/linux/man-pages/man2/wait4.2.html
    wait4(61, rdi: upid, rsi: stat_addr, rdx: options, r10: ru)
}

define_syscall! {
    /// Call the [`kill`] system call in the target process.
    ///
    /// [`kill`]: https://man7.org/linux/man-pages/man2/kill.2.html
    kill(62, rdi: pid, rsi: sig)
}

define_syscall! {
    /// Call the [`uname`] system call in the target process.
    ///
    /// [`uname`]: https://man7.org/linux/man-pages/man2/uname.2.html
    uname(63, rdi: name)
}

define_syscall! {
    /// Call the [`semget`] system call in the target process.
    ///
    /// [`semget`]: https://man7.org/linux/man-pages/man2/semget.2.html
    semget(64, rdi: key, rsi: nsems, rdx: semflg)
}

define_syscall! {
    /// Call the [`semop`] system call in the target process.
    ///
    /// [`semop`]: https://man7.org/linux/man-pages/man2/semop.2.html
    semop(65, rdi: semid, rsi: tsops, rdx: nsops)
}

define_syscall! {
    /// Call the [`semctl`] system call in the target process.
    ///
    /// [`semctl`]: https://man7.org/linux/man-pages/man2/semctl.2.html
    semctl(66, rdi: semid, rsi: semnum, rdx: cmd, r10: arg)
}

define_syscall! {
    /// Call the [`shmdt`] system call in the target process.
    ///
    /// [`shmdt`]: https://man7.org/linux/man-pages/man2/shmdt.2.html
    shmdt(67, rdi: shmaddr)
}

define_syscall! {
    /// Call the [`msgget`] system call in the target process.
    ///
    /// [`msgget`]: https://man7.org/linux/man-pages/man2/msgget.2.html
    msgget(68, rdi: key, rsi: msgflg)
}

define_syscall! {
    /// Call the [`msgsnd`] system call in the target process.
    ///
    /// [`msgsnd`]: https://man7.org/linux/man-pages/man2/msgsnd.2.html
    msgsnd(69, rdi: msqid, rsi: msgp, rdx: msgsz, r10: msgflg)
}

define_syscall! {
    /// Call the [`msgrcv`] system call in the target process.
    ///
    /// [`msgrcv`]: https://man7.org/linux/man-pages/man2/msgrcv.2.html
    msgrcv(70, rdi: msqid, rsi: msgp, rdx: msgsz, r10: msgtyp, r8: msgflg)
}

define_syscall! {
    /// Call the [`msgctl`] system call in the target process.
    ///
    /// [`msgctl`]: https://man7.org/linux/man-pages/man2/msgctl.2.html
    msgctl(71, rdi: msqid, rsi: cmd, rdx: buf)
}

define_syscall! {
    /// Call the [`fcntl`] system call in the target process.
    ///
    /// [`fcntl`]: https://man7.org/linux/man-pages/man2/fcntl.2.html
    fcntl(72, rdi: fd, rsi: cmd, rdx: arg)
}

define_syscall! {
    /// Call the [`flock`] system call in the target process.
    ///
    /// [`flock`]: https://man7.org/linux/man-pages/man2/flock.2.html
    flock(73, rdi: fd, rsi: cmd)
}

define_syscall! {
    /// Call the [`fsync`] system call in the target process.
    ///
    /// [`fsync`]: https://man7.org/linux/man-pages/man2/fsync.2.html
    fsync(74, rdi: fd)
}

define_syscall! {
    /// Call the [`fdatasync`] system call in the target process.
    ///
    /// [`fdatasync`]: https://man7.org/linux/man-pages/man2/fdatasync.2.html
    fdatasync(75, rdi: fd)
}

define_syscall! {
    /// Call the [`truncate`] system call in the target process.
    ///
    /// [`truncate`]: https://man7.org/linux/man-pages/man2/truncate.2.html
    truncate(76, rdi: path, rsi: length)
}

define_syscall! {
    /// Call the [`ftruncate`] system call in the target process.
    ///
    /// [`ftruncate`]: https://man7.org/linux/man-pages/man2/ftruncate.2.html
    ftruncate(77, rdi: fd, rsi: length)
}

define_syscall! {
    /// Call the [`getdents`] system call in the target process.
    ///
    /// [`getdents`]: https://man7.org/linux/man-pages/man2/getdents.2.html
    getdents(78, rdi: fd, rsi: dirent, rdx: count)
}

define_syscall! {
    /// Call the [`getcwd`] system call in the target process.
    ///
    /// [`getcwd`]: https://man7.org/linux/man-pages/man2/getcwd.2.html
    getcwd(79, rdi: buf, rsi: size)
}

define_syscall! {
    /// Call the [`chdir`] system call in the target process.
    ///
    /// [`chdir`]: https://man7.org/linux/man-pages/man2/chdir.2.html
    chdir(80, rdi: filename)
}

define_syscall! {
    /// Call the [`fchdir`] system call in the target process.
    ///
    /// [`fchdir`]: https://man7.org/linux/man-pages/man2/fchdir.2.html
    fchdir(81, rdi: fd)
}

define_syscall! {
    /// Call the [`rename`] system call in the target process.
    ///
    /// [`rename`]: https://man7.org/linux/man-pages/man2/rename.2.html
    rename(82, rdi: oldname, rsi: newname)
}

define_syscall! {
    /// Call the [`mkdir`] system call in the target process.
    ///
    /// [`mkdir`]: https://man7.org/linux/man-pages/man2/mkdir.2.html
    mkdir(83, rdi: pathname, rsi: mode)
}

define_syscall! {
    /// Call the [`rmdir`] system call in the target process.
    ///
    /// [`rmdir`]: https://man7.org/linux/man-pages/man2/rmdir.2.html
    rmdir(84, rdi: pathname)
}

define_syscall! {
    /// Call the [`creat`] system call in the target process.
    ///
    /// [`creat`]: https://man7.org/linux/man-pages/man2/creat.2.html
    creat(85, rdi: pathname, rsi: mode)
}

define_syscall! {
    /// Call the [`link`] system call in the target process.
    ///
    /// [`link`]: https://man7.org/linux/man-pages/man2/link.2.html
    link(86, rdi: oldname, rsi: newname)
}

define_syscall! {
    /// Call the [`unlink`] system call in the target process.
    ///
    /// [`unlink`]: https://man7.org/linux/man-pages/man2/unlink.2.html
    unlink(87, rdi: pathname)
}

define_syscall! {
    /// Call the [`symlink`] system call in the target process.
    ///
    /// [`symlink`]: https://man7.org/linux/man-pages/man2/symlink.2.html
    symlink(88, rdi: oldname, rsi: newname)
}

define_syscall! {
    /// Call the [`readlink`] system call in the target process.
    ///
    /// [`readlink`]: https://man7.org/linux/man-pages/man2/readlink.2.html
    readlink(89, rdi: path, rsi: buf, rdx: bufsiz)
}

define_syscall! {
    /// Call the [`chmod`] system call in the target process.
    ///
    /// [`chmod`]: https://man7.org/linux/man-pages/man2/chmod.2.html
    chmod(90, rdi: filename, rsi: mode)
}

define_syscall! {
    /// Call the [`fchmod`] system call in the target process.
    ///
    /// [`fchmod`]: https://man7.org/linux/man-pages/man2/fchmod.2.html
    fchmod(91, rdi: fd, rsi: mode)
}

define_syscall! {
    /// Call the [`chown`] system call in the target process.
    ///
    /// [`chown`]: https://man7.org/linux/man-pages/man2/chown.2.html
    chown(92, rdi: filename, rsi: user, rdx: group)
}

define_syscall! {
    /// Call the [`fchown`] system call in the target process.
    ///
    /// [`fchown`]: https://man7.org/linux/man-pages/man2/fchown.2.html
    fchown(93, rdi: fd, rsi: user, rdx: group)
}

define_syscall! {
    /// Call the [`lchown`] system call in the target process.
    ///
    /// [`lchown`]: https://man7.org/linux/man-pages/man2/lchown.2.html
    lchown(94, rdi: filename, rsi: user, rdx: group)
}

define_syscall! {
    /// Call the [`umask`] system call in the target process.
    ///
    /// [`umask`]: https://man7.org/linux/man-pages/man2/umask.2.html
    umask(95, rdi: mask)
}

define_syscall! {
    /// Call the [`gettimeofday`] system call in the target process.
    ///
    /// [`gettimeofday`]: https://man7.org/linux/man-pages/man2/gettimeofday.2.html
    gettimeofday(96, rdi: tv, rsi: tz)
}

define_syscall! {
    /// Call the [`getrlimit`] system call in the target process.
    ///
    /// [`getrlimit`]: https://man7.org/linux/man-pages/man2/getrlimit.2.html
    getrlimit(97, rdi: resource, rsi: rlim)
}

define_syscall! {
    /// Call the [`getrusage`] system call in the target process.
    ///
    /// [`getrusage`]: https://man7.org/linux/man-pages/man2/getrusage.2.html
    getrusage(98, rdi: who, rsi: ru)
}

define_syscall! {
    /// Call the [`sysinfo`] system call in the target process.
    ///
    /// [`sysinfo`]: https://man7.org/linux/man-pages/man2/sysinfo.2.html
    sysinfo(99, rdi: info)
}

define_syscall! {
    /// Call the [`times`] system call in the target process.
    ///
    /// [`times`]: https://man7.org/linux/man-pages/man2/times.2.html
    times(100, rdi: tbuf)
}

define_syscall! {
    /// Call the [`ptrace`] system call in the target process.
    ///
    /// [`ptrace`]: https://man7.org/linux/man-pages/man2/ptrace.2.html
    ptrace(101, rdi: request, rsi: pid, rdx: addr, r10: data)
}

define_syscall! {
    /// Call the [`setgid`] system call in the target process.
    ///
    /// [`setgid`]: https://man7.org/linux/man-pages/man2/setgid.2.html
    setgid(106, rdi: gid)
}

define_syscall! {
    /// Call the [`setpgid`] system call in the target process.
    ///
    /// [`setpgid`]: https://man7.org/linux/man-pages/man2/setpgid.2.html
    setpgid(109, rdi: pid, rsi: pgid)
}

define_syscall! {
    /// Call the [`setregid`] system call in the target process.
    ///
    /// [`setregid`]: https://man7.org/linux/man-pages/man2/setregid.2.html
    setregid(114, rdi: rgid, rsi: egid)
}

define_syscall! {
    /// Call the [`getgroups`] system call in the target process.
    ///
    /// [`getgroups`]: https://man7.org/linux/man-pages/man2/getgroups.2.html
    getgroups(115, rdi: gidsetsize, rsi: grouplist)
}

define_syscall! {
    /// Call the [`setgroups`] system call in the target process.
    ///
    /// [`setgroups`]: https://man7.org/linux/man-pages/man2/setgroups.2.html
    setgroups(116, rdi: gidsetsize, rsi: grouplist)
}

define_syscall! {
    /// Call the [`setresuid`] system call in the target process.
    ///
    /// [`setresuid`]: https://man7.org/linux/man-pages/man2/setresuid.2.html
    setresuid(117, rdi: ruid, rsi: euid, rdx: suid)
}

define_syscall! {
    /// Call the [`getresuid`] system call in the target process.
    ///
    /// [`getresuid`]: https://man7.org/linux/man-pages/man2/getresuid.2.html
    getresuid(118, rdi: ruidp, rsi: euidp, rdx: suidp)
}

define_syscall! {
    /// Call the [`setresgid`] system call in the target process.
    ///
    /// [`setresgid`]: https://man7.org/linux/man-pages/man2/setresgid.2.html
    setresgid(119, rdi: rgid, rsi: egid, rdx: sgid)
}

define_syscall! {
    /// Call the [`getresgid`] system call in the target process.
    ///
    /// [`getresgid`]: https://man7.org/linux/man-pages/man2/getresgid.2.html
    getresgid(120, rdi: rgidp, rsi: egidp, rdx: sgidp)
}

define_syscall! {
    /// Call the [`getpgid`] system call in the target process.
    ///
    /// [`getpgid`]: https://man7.org/linux/man-pages/man2/getpgid.2.html
    getpgid(121, rdi: pid)
}

define_syscall! {
    /// Call the [`setfsuid`] system call in the target process.
    ///
    /// [`setfsuid`]: https://man7.org/linux/man-pages/man2/setfsuid.2.html
    setfsuid(122, rdi: uid)
}

define_syscall! {
    /// Call the [`setfsgid`] system call in the target process.
    ///
    /// [`setfsgid`]: https://man7.org/linux/man-pages/man2/setfsgid.2.html
    setfsgid(123, rdi: gid)
}

define_syscall! {
    /// Call the [`getsid`] system call in the target process.
    ///
    /// [`getsid`]: https://man7.org/linux/man-pages/man2/getsid.2.html
    getsid(124, rdi: pid)
}

define_syscall! {
    /// Call the [`capget`] system call in the target process.
    ///
    /// [`capget`]: https://man7.org/linux/man-pages/man2/capget.2.html
    capget(125, rdi: header, rsi: dataptr)
}

define_syscall! {
    /// Call the [`capset`] system call in the target process.
    ///
    /// [`capset`]: https://man7.org/linux/man-pages/man2/capset.2.html
    capset(126, rdi: header, rsi: data)
}

define_syscall! {
    /// Call the [`rt_sigpending`] system call in the target process.
    ///
    /// [`rt_sigpending`]: https://man7.org/linux/man-pages/man2/rt_sigpending.2.html
    rt_sigpending(127, rdi: uset, rsi: sigsetsize)
}

define_syscall! {
    /// Call the [`rt_sigtimedwait`] system call in the target process.
    ///
    /// [`rt_sigtimedwait`]: https://man7.org/linux/man-pages/man2/rt_sigtimedwait.2.html
    rt_sigtimedwait(128, rdi: uthese, rsi: uinfo, rdx: uts, r10: sigsetsize)
}

define_syscall! {
    /// Call the [`rt_sigqueueinfo`] system call in the target process.
    ///
    /// [`rt_sigqueueinfo`]: https://man7.org/linux/man-pages/man2/rt_sigqueueinfo.2.html
    rt_sigqueueinfo(129, rdi: pid, rsi: sig, rdx: uinfo)
}

define_syscall! {
    /// Call the [`rt_sigsuspend`] system call in the target process.
    ///
    /// [`rt_sigsuspend`]: https://man7.org/linux/man-pages/man2/rt_sigsuspend.2.html
    rt_sigsuspend(130, rdi: unewset, rsi: sigsetsize)
}

define_syscall! {
    /// Call the [`sigaltstack`] system call in the target process.
    ///
    /// [`sigaltstack`]: https://man7.org/linux/man-pages/man2/sigaltstack.2.html
    sigaltstack(131, rdi: uss, rsi: uoss)
}

define_syscall! {
    /// Call the [`utime`] system call in the target process.
    ///
    /// [`utime`]: https://man7.org/linux/man-pages/man2/utime.2.html
    utime(132, rdi: filename, rsi: times)
}

define_syscall! {
    /// Call the [`mknod`] system call in the target process.
    ///
    /// [`mknod`]: https://man7.org/linux/man-pages/man2/mknod.2.html
    mknod(133, rdi: filename, rsi: mode, rdx: dev)
}

define_syscall! {
    /// Call the [`uselib`] system call in the target process.
    ///
    /// [`uselib`]: https://man7.org/linux/man-pages/man2/uselib.2.html
    uselib(134, rdi: library)
}

define_syscall! {
    /// Call the [`personality`] system call in the target process.
    ///
    /// [`personality`]: https://man7.org/linux/man-pages/man2/personality.2.html
    personality(135, rdi: personality)
}

define_syscall! {
    /// Call the [`ustat`] system call in the target process.
    ///
    /// [`ustat`]: https://man7.org/linux/man-pages/man2/ustat.2.html
    ustat(136, rdi: dev, rsi: ubuf)
}

define_syscall! {
    /// Call the [`statfs`] system call in the target process.
    ///
    /// [`statfs`]: https://man7.org/linux/man-pages/man2/statfs.2.html
    statfs(137, rdi: pathname, rsi: buf)
}

define_syscall! {
    /// Call the [`fstatfs`] system call in the target process.
    ///
    /// [`fstatfs`]: https://man7.org/linux/man-pages/man2/fstatfs.2.html
    fstatfs(138, rdi: fd, rsi: buf)
}

define_syscall! {
    /// Call the [`sysfs`] system call in the target process.
    ///
    /// [`sysfs`]: https://man7.org/linux/man-pages/man2/sysfs.2.html
    sysfs(139, rdi: option, rsi: arg1, rdx: arg2)
}

define_syscall! {
    /// Call the [`getpriority`] system call in the target process.
    ///
    /// [`getpriority`]: https://man7.org/linux/man-pages/man2/getpriority.2.html
    getpriority(140, rdi: which, rsi: who)
}

define_syscall! {
    /// Call the [`setpriority`] system call in the target process.
    ///
    /// [`setpriority`]: https://man7.org/linux/man-pages/man2/setpriority.2.html
    setpriority(141, rdi: which, rsi: who, rdx: niceval)
}

define_syscall! {
    /// Call the [`sched_setparam`] system call in the target process.
    ///
    /// [`sched_setparam`]: https://man7.org/linux/man-pages/man2/sched_setparam.2.html
    sched_setparam(142, rdi: pid, rsi: param)
}

define_syscall! {
    /// Call the [`sched_getparam`] system call in the target process.
    ///
    /// [`sched_getparam`]: https://man7.org/linux/man-pages/man2/sched_getparam.2.html
    sched_getparam(143, rdi: pid, rsi: param)
}

define_syscall! {
    /// Call the [`sched_setscheduler`] system call in the target process.
    ///
    /// [`sched_setscheduler`]: https://man7.org/linux/man-pages/man2/sched_setscheduler.2.html
    sched_setscheduler(144, rdi: pid, rsi: policy, rdx: param)
}

define_syscall! {
    /// Call the [`sched_getscheduler`] system call in the target process.
    ///
    /// [`sched_getscheduler`]: https://man7.org/linux/man-pages/man2/sched_getscheduler.2.html
    sched_getscheduler(145, rdi: pid)
}

define_syscall! {
    /// Call the [`sched_get_priority_max`] system call in the target process.
    ///
    /// [`sched_get_priority_max`]: https://man7.org/linux/man-pages/man2/sched_get_priority_max.2.html
    sched_get_priority_max(146, rdi: policy)
}

define_syscall! {
    /// Call the [`sched_get_priority_min`] system call in the target process.
    ///
    /// [`sched_get_priority_min`]: https://man7.org/linux/man-pages/man2/sched_get_priority_min.2.html
    sched_get_priority_min(147, rdi: policy)
}

define_syscall! {
    /// Call the [`sched_rr_get_interval`] system call in the target process.
    ///
    /// [`sched_rr_get_interval`]: https://man7.org/linux/man-pages/man2/sched_rr_get_interval.2.html
    sched_rr_get_interval(148, rdi: pid, rsi: interval)
}

define_syscall! {
    /// Call the [`mlock`] system call in the target process.
    ///
    /// [`mlock`]: https://man7.org/linux/man-pages/man2/mlock.2.html
    mlock(149, rdi: start, rsi: len)
}

define_syscall! {
    /// Call the [`munlock`] system call in the target process.
    ///
    /// [`munlock`]: https://man7.org/linux/man-pages/man2/munlock.2.html
    munlock(150, rdi: start, rsi: len)
}

define_syscall! {
    /// Call the [`mlockall`] system call in the target process.
    ///
    /// [`mlockall`]: https://man7.org/linux/man-pages/man2/mlockall.2.html
    mlockall(151, rdi: flags)
}

define_syscall! {
    /// Call the [`modify_ldt`] system call in the target process.
    ///
    /// [`modify_ldt`]: https://man7.org/linux/man-pages/man2/modify_ldt.2.html
    modify_ldt(154, rdi: func, rsi: ptr, rdx: bytecount)
}

define_syscall! {
    /// Call the [`pivot_root`] system call in the target process.
    ///
    /// [`pivot_root`]: https://man7.org/linux/man-pages/man2/pivot_root.2.html
    pivot_root(155, rdi: new_root, rsi: put_old)
}

define_syscall! {
    /// Call the [`_sysctl`] system call in the target process.
    ///
    /// [`_sysctl`]: https://man7.org/linux/man-pages/man2/_sysctl.2.html
    _sysctl(156, rdi: args)
}

define_syscall! {
    /// Call the [`prctl`] system call in the target process.
    ///
    /// [`prctl`]: https://man7.org/linux/man-pages/man2/prctl.2.html
    prctl(157, rdi: option, rsi: arg2, rdx: arg3, r10: arg4, r8: arg5)
}

define_syscall! {
    /// Call the [`arch_prctl`] system call in the target process.
    ///
    /// [`arch_prctl`]: https://man7.org/linux/man-pages/man2/arch_prctl.2.html
    arch_prctl(158, rdi: task, rsi: code, rdx: addr)
}

define_syscall! {
    /// Call the [`adjtimex`] system call in the target process.
    ///
    /// [`adjtimex`]: https://man7.org/linux/man-pages/man2/adjtimex.2.html
    adjtimex(159, rdi: txc_p)
}

define_syscall! {
    /// Call the [`setrlimit`] system call in the target process.
    ///
    /// [`setrlimit`]: https://man7.org/linux/man-pages/man2/setrlimit.2.html
    setrlimit(160, rdi: resource, rsi: rlim)
}

define_syscall! {
    /// Call the [`chroot`] system call in the target process.
    ///
    /// [`chroot`]: https://man7.org/linux/man-pages/man2/chroot.2.html
    chroot(161, rdi: filename)
}

define_syscall! {
    /// Call the [`settimeofday`] system call in the target process.
    ///
    /// [`settimeofday`]: https://man7.org/linux/man-pages/man2/settimeofday.2.html
    settimeofday(164, rdi: tv, rsi: tz)
}

define_syscall! {
    /// Call the [`mount`] system call in the target process.
    ///
    /// [`mount`]: https://man7.org/linux/man-pages/man2/mount.2.html
    mount(165, rdi: dev_name, rsi: dir_name, rdx: type_, r10: flags, r8: data)
}

define_syscall! {
    /// Call the [`umount2`] system call in the target process.
    ///
    /// [`umount2`]: https://man7.org/linux/man-pages/man2/umount2.2.html
    umount2(166, rdi: name, rsi: flags)
}

define_syscall! {
    /// Call the [`swapon`] system call in the target process.
    ///
    /// [`swapon`]: https://man7.org/linux/man-pages/man2/swapon.2.html
    swapon(167, rdi: specialfile, rsi: swap_flags)
}

define_syscall! {
    /// Call the [`swapoff`] system call in the target process.
    ///
    /// [`swapoff`]: https://man7.org/linux/man-pages/man2/swapoff.2.html
    swapoff(168, rdi: specialfile)
}

define_syscall! {
    /// Call the [`reboot`] system call in the target process.
    ///
    /// [`reboot`]: https://man7.org/linux/man-pages/man2/reboot.2.html
    reboot(169, rdi: magic1, rsi: magic2, rdx: cmd, r10: arg)
}

define_syscall! {
    /// Call the [`sethostname`] system call in the target process.
    ///
    /// [`sethostname`]: https://man7.org/linux/man-pages/man2/sethostname.2.html
    sethostname(170, rdi: name, rsi: len)
}

define_syscall! {
    /// Call the [`setdomainname`] system call in the target process.
    ///
    /// [`setdomainname`]: https://man7.org/linux/man-pages/man2/setdomainname.2.html
    setdomainname(171, rdi: name, rsi: len)
}

define_syscall! {
    /// Call the [`iopl`] system call in the target process.
    ///
    /// [`iopl`]: https://man7.org/linux/man-pages/man2/iopl.2.html
    iopl(172, rdi: level)
}

define_syscall! {
    /// Call the [`ioperm`] system call in the target process.
    ///
    /// [`ioperm`]: https://man7.org/linux/man-pages/man2/ioperm.2.html
    ioperm(173, rdi: from, rsi: num, rdx: turn_on)
}

define_syscall! {
    /// Call the [`init_module`] system call in the target process.
    ///
    /// [`init_module`]: https://man7.org/linux/man-pages/man2/init_module.2.html
    init_module(175, rdi: umod, rsi: len, rdx: uargs)
}

define_syscall! {
    /// Call the [`delete_module`] system call in the target process.
    ///
    /// [`delete_module`]: https://man7.org/linux/man-pages/man2/delete_module.2.html
    delete_module(176, rdi: name_user, rsi: flags)
}

define_syscall! {
    /// Call the [`quotactl`] system call in the target process.
    ///
    /// [`quotactl`]: https://man7.org/linux/man-pages/man2/quotactl.2.html
    quotactl(179, rdi: cmd, rsi: special, rdx: id, r10: addr)
}

define_syscall! {
    /// Call the [`setxattr`] system call in the target process.
    ///
    /// [`setxattr`]: https://man7.org/linux/man-pages/man2/setxattr.2.html
    setxattr(188, rdi: pathname, rsi: name, rdx: value, r10: size, r8: flags)
}

define_syscall! {
    /// Call the [`lsetxattr`] system call in the target process.
    ///
    /// [`lsetxattr`]: https://man7.org/linux/man-pages/man2/lsetxattr.2.html
    lsetxattr(189, rdi: pathname, rsi: name, rdx: value, r10: size, r8: flags)
}

define_syscall! {
    /// Call the [`fsetxattr`] system call in the target process.
    ///
    /// [`fsetxattr`]: https://man7.org/linux/man-pages/man2/fsetxattr.2.html
    fsetxattr(190, rdi: fd, rsi: name, rdx: value, r10: size, r8: flags)
}

define_syscall! {
    /// Call the [`getxattr`] system call in the target process.
    ///
    /// [`getxattr`]: https://man7.org/linux/man-pages/man2/getxattr.2.html
    getxattr(191, rdi: pathname, rsi: name, rdx: value, r10: size)
}

define_syscall! {
    /// Call the [`lgetxattr`] system call in the target process.
    ///
    /// [`lgetxattr`]: https://man7.org/linux/man-pages/man2/lgetxattr.2.html
    lgetxattr(192, rdi: pathname, rsi: name, rdx: value, r10: size)
}

define_syscall! {
    /// Call the [`fgetxattr`] system call in the target process.
    ///
    /// [`fgetxattr`]: https://man7.org/linux/man-pages/man2/fgetxattr.2.html
    fgetxattr(193, rdi: fd, rsi: name, rdx: value, r10: size)
}

define_syscall! {
    /// Call the [`listxattr`] system call in the target process.
    ///
    /// [`listxattr`]: https://man7.org/linux/man-pages/man2/listxattr.2.html
    listxattr(194, rdi: pathname, rsi: list, rdx: size)
}

define_syscall! {
    /// Call the [`llistxattr`] system call in the target process.
    ///
    /// [`llistxattr`]: https://man7.org/linux/man-pages/man2/llistxattr.2.html
    llistxattr(195, rdi: pathname, rsi: list, rdx: size)
}

define_syscall! {
    /// Call the [`flistxattr`] system call in the target process.
    ///
    /// [`flistxattr`]: https://man7.org/linux/man-pages/man2/flistxattr.2.html
    flistxattr(196, rdi: fd, rsi: list, rdx: size)
}

define_syscall! {
    /// Call the [`removexattr`] system call in the target process.
    ///
    /// [`removexattr`]: https://man7.org/linux/man-pages/man2/removexattr.2.html
    removexattr(197, rdi: pathname, rsi: name)
}

define_syscall! {
    /// Call the [`lremovexattr`] system call in the target process.
    ///
    /// [`lremovexattr`]: https://man7.org/linux/man-pages/man2/lremovexattr.2.html
    lremovexattr(198, rdi: pathname, rsi: name)
}

define_syscall! {
    /// Call the [`fremovexattr`] system call in the target process.
    ///
    /// [`fremovexattr`]: https://man7.org/linux/man-pages/man2/fremovexattr.2.html
    fremovexattr(199, rdi: fd, rsi: name)
}

define_syscall! {
    /// Call the [`tkill`] system call in the target process.
    ///
    /// [`tkill`]: https://man7.org/linux/man-pages/man2/tkill.2.html
    tkill(200, rdi: pid, rsi: sig)
}

define_syscall! {
    /// Call the [`time`] system call in the target process.
    ///
    /// [`time`]: https://man7.org/linux/man-pages/man2/time.2.html
    time(201, rdi: tloc)
}

define_syscall! {
    /// Call the [`futex`] system call in the target process.
    ///
    /// [`futex`]: https://man7.org/linux/man-pages/man2/futex.2.html
    futex(202, rdi: uaddr, rsi: op, rdx: val, r10: utime, r8: uaddr2, r9: val3)
}

define_syscall! {
    /// Call the [`sched_setaffinity`] system call in the target process.
    ///
    /// [`sched_setaffinity`]: https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html
    sched_setaffinity(203, rdi: pid, rsi: len, rdx: user_mask_ptr)
}

define_syscall! {
    /// Call the [`sched_getaffinity`] system call in the target process.
    ///
    /// [`sched_getaffinity`]: https://man7.org/linux/man-pages/man2/sched_getaffinity.2.html
    sched_getaffinity(204, rdi: pid, rsi: len, rdx: user_mask_ptr)
}

define_syscall! {
    /// Call the [`set_thread_area`] system call in the target process.
    ///
    /// [`set_thread_area`]: https://man7.org/linux/man-pages/man2/set_thread_area.2.html
    set_thread_area(205, rdi: u_info)
}

define_syscall! {
    /// Call the [`io_setup`] system call in the target process.
    ///
    /// [`io_setup`]: https://man7.org/linux/man-pages/man2/io_setup.2.html
    io_setup(206, rdi: nr_events, rsi: ctxp)
}

define_syscall! {
    /// Call the [`io_destroy`] system call in the target process.
    ///
    /// [`io_destroy`]: https://man7.org/linux/man-pages/man2/io_destroy.2.html
    io_destroy(207, rdi: ctx)
}

define_syscall! {
    /// Call the [`io_getevents`] system call in the target process.
    ///
    /// [`io_getevents`]: https://man7.org/linux/man-pages/man2/io_getevents.2.html
    io_getevents(208, rdi: ctx_id, rsi: min_nr, rdx: nr, r10: events, r8: timeout)
}

define_syscall! {
    /// Call the [`io_submit`] system call in the target process.
    ///
    /// [`io_submit`]: https://man7.org/linux/man-pages/man2/io_submit.2.html
    io_submit(209, rdi: ctx_id, rsi: nr, rdx: iocbpp)
}

define_syscall! {
    /// Call the [`io_cancel`] system call in the target process.
    ///
    /// [`io_cancel`]: https://man7.org/linux/man-pages/man2/io_cancel.2.html
    io_cancel(210, rdi: ctx_id, rsi: iocb, rdx: result)
}

define_syscall! {
    /// Call the [`get_thread_area`] system call in the target process.
    ///
    /// [`get_thread_area`]: https://man7.org/linux/man-pages/man2/get_thread_area.2.html
    get_thread_area(211, rdi: u_info)
}

define_syscall! {
    /// Call the [`lookup_dcookie`] system call in the target process.
    ///
    /// [`lookup_dcookie`]: https://man7.org/linux/man-pages/man2/lookup_dcookie.2.html
    lookup_dcookie(212, rdi: cookie64, rsi: buf, rdx: len)
}

define_syscall! {
    /// Call the [`epoll_create`] system call in the target process.
    ///
    /// [`epoll_create`]: https://man7.org/linux/man-pages/man2/epoll_create.2.html
    epoll_create(213, rdi: size)
}

define_syscall! {
    /// Call the [`remap_file_pages`] system call in the target process.
    ///
    /// [`remap_file_pages`]: https://man7.org/linux/man-pages/man2/remap_file_pages.2.html
    remap_file_pages(216, rdi: start, rsi: size, rdx: prot, r10: pgoff, r8: flags)
}

define_syscall! {
    /// Call the [`getdents64`] system call in the target process.
    ///
    /// [`getdents64`]: https://man7.org/linux/man-pages/man2/getdents64.2.html
    getdents64(217, rdi: fd, rsi: dirent, rdx: count)
}

define_syscall! {
    /// Call the [`set_tid_address`] system call in the target process.
    ///
    /// [`set_tid_address`]: https://man7.org/linux/man-pages/man2/set_tid_address.2.html
    set_tid_address(218, rdi: tidptr)
}

define_syscall! {
    /// Call the [`fadvise64`] system call in the target process.
    ///
    /// [`fadvise64`]: https://man7.org/linux/man-pages/man2/fadvise64.2.html
    fadvise64(221, rdi: fd, rsi: offset, rdx: len, r10: advice)
}

define_syscall! {
    /// Call the [`timer_create`] system call in the target process.
    ///
    /// [`timer_create`]: https://man7.org/linux/man-pages/man2/timer_create.2.html
    timer_create(222, rdi: which_clock, rsi: timer_event_spec, rdx: created_timer_id)
}

define_syscall! {
    /// Call the [`timer_settime`] system call in the target process.
    ///
    /// [`timer_settime`]: https://man7.org/linux/man-pages/man2/timer_settime.2.html
    timer_settime(223, rdi: timer_id, rsi: flags, rdx: new_setting, r10: old_setting)
}

define_syscall! {
    /// Call the [`timer_gettime`] system call in the target process.
    ///
    /// [`timer_gettime`]: https://man7.org/linux/man-pages/man2/timer_gettime.2.html
    timer_gettime(224, rdi: timer_id, rsi: setting)
}

define_syscall! {
    /// Call the [`timer_getoverrun`] system call in the target process.
    ///
    /// [`timer_getoverrun`]: https://man7.org/linux/man-pages/man2/timer_getoverrun.2.html
    timer_getoverrun(225, rdi: timer_id)
}

define_syscall! {
    /// Call the [`timer_delete`] system call in the target process.
    ///
    /// [`timer_delete`]: https://man7.org/linux/man-pages/man2/timer_delete.2.html
    timer_delete(226, rdi: timer_id)
}

define_syscall! {
    /// Call the [`clock_settime`] system call in the target process.
    ///
    /// [`clock_settime`]: https://man7.org/linux/man-pages/man2/clock_settime.2.html
    clock_settime(227, rdi: which_clock, rsi: tp)
}

define_syscall! {
    /// Call the [`clock_gettime`] system call in the target process.
    ///
    /// [`clock_gettime`]: https://man7.org/linux/man-pages/man2/clock_gettime.2.html
    clock_gettime(228, rdi: which_clock, rsi: tp)
}

define_syscall! {
    /// Call the [`clock_getres`] system call in the target process.
    ///
    /// [`clock_getres`]: https://man7.org/linux/man-pages/man2/clock_getres.2.html
    clock_getres(229, rdi: which_clock, rsi: tp)
}

define_syscall! {
    /// Call the [`clock_nanosleep`] system call in the target process.
    ///
    /// [`clock_nanosleep`]: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
    clock_nanosleep(230, rdi: which_clock, rsi: flags, rdx: rqtp, r10: rmtp)
}

define_syscall! {
    /// Call the [`exit_group`] system call in the target process.
    ///
    /// [`exit_group`]: https://man7.org/linux/man-pages/man2/exit_group.2.html
    exit_group(231, rdi: error_code)
}

define_syscall! {
    /// Call the [`epoll_wait`] system call in the target process.
    ///
    /// [`epoll_wait`]: https://man7.org/linux/man-pages/man2/epoll_wait.2.html
    epoll_wait(232, rdi: epfd, rsi: events, rdx: maxevents, r10: timeout)
}

define_syscall! {
    /// Call the [`epoll_ctl`] system call in the target process.
    ///
    /// [`epoll_ctl`]: https://man7.org/linux/man-pages/man2/epoll_ctl.2.html
    epoll_ctl(233, rdi: epfd, rsi: op, rdx: fd, r10: event)
}

define_syscall! {
    /// Call the [`tgkill`] system call in the target process.
    ///
    /// [`tgkill`]: https://man7.org/linux/man-pages/man2/tgkill.2.html
    tgkill(234, rdi: tgid, rsi: pid, rdx: sig)
}

define_syscall! {
    /// Call the [`utimes`] system call in the target process.
    ///
    /// [`utimes`]: https://man7.org/linux/man-pages/man2/utimes.2.html
    utimes(235, rdi: filename, rsi: utimes)
}

define_syscall! {
    /// Call the [`mbind`] system call in the target process.
    ///
    /// [`mbind`]: https://man7.org/linux/man-pages/man2/mbind.2.html
    mbind(237, rdi: start, rsi: len, rdx: mode, r10: nmask, r8: maxnode, r9: flags)
}

define_syscall! {
    /// Call the [`set_mempolicy`] system call in the target process.
    ///
    /// [`set_mempolicy`]: https://man7.org/linux/man-pages/man2/set_mempolicy.2.html
    set_mempolicy(238, rdi: mode, rsi: nmask, rdx: maxnode)
}

define_syscall! {
    /// Call the [`get_mempolicy`] system call in the target process.
    ///
    /// [`get_mempolicy`]: https://man7.org/linux/man-pages/man2/get_mempolicy.2.html
    get_mempolicy(239, rdi: policy, rsi: nmask, rdx: maxnode, r10: addr, r8: flags)
}

define_syscall! {
    /// Call the [`mq_open`] system call in the target process.
    ///
    /// [`mq_open`]: https://man7.org/linux/man-pages/man2/mq_open.2.html
    mq_open(240, rdi: u_name, rsi: oflag, rdx: mode, r10: u_attr)
}

define_syscall! {
    /// Call the [`mq_unlink`] system call in the target process.
    ///
    /// [`mq_unlink`]: https://man7.org/linux/man-pages/man2/mq_unlink.2.html
    mq_unlink(241, rdi: u_name)
}

define_syscall! {
    /// Call the [`mq_timedsend`] system call in the target process.
    ///
    /// [`mq_timedsend`]: https://man7.org/linux/man-pages/man2/mq_timedsend.2.html
    mq_timedsend(242, rdi: mqdes, rsi: u_msg_ptr, rdx: msg_len, r10: msg_prio, r8: u_abs_timeout)
}

define_syscall! {
    /// Call the [`mq_timedreceive`] system call in the target process.
    ///
    /// [`mq_timedreceive`]: https://man7.org/linux/man-pages/man2/mq_timedreceive.2.html
    mq_timedreceive(243, rdi: mqdes, rsi: u_msg_ptr, rdx: msg_len, r10: u_msg_prio, r8: u_abs_timeout)
}

define_syscall! {
    /// Call the [`mq_notify`] system call in the target process.
    ///
    /// [`mq_notify`]: https://man7.org/linux/man-pages/man2/mq_notify.2.html
    mq_notify(244, rdi: mqdes, rsi: u_notification)
}

define_syscall! {
    /// Call the [`mq_getsetattr`] system call in the target process.
    ///
    /// [`mq_getsetattr`]: https://man7.org/linux/man-pages/man2/mq_getsetattr.2.html
    mq_getsetattr(245, rdi: mqdes, rsi: u_mqstat, rdx: u_omqstat)
}

define_syscall! {
    /// Call the [`kexec_load`] system call in the target process.
    ///
    /// [`kexec_load`]: https://man7.org/linux/man-pages/man2/kexec_load.2.html
    kexec_load(246, rdi: entry, rsi: nr_segments, rdx: segments, r10: flags)
}

define_syscall! {
    /// Call the [`waitid`] system call in the target process.
    ///
    /// [`waitid`]: https://man7.org/linux/man-pages/man2/waitid.2.html
    waitid(247, rdi: which, rsi: upid, rdx: infop, r10: options, r8: ru)
}

define_syscall! {
    /// Call the [`add_key`] system call in the target process.
    ///
    /// [`add_key`]: https://man7.org/linux/man-pages/man2/add_key.2.html
    add_key(248, rdi: _type_, rsi: _description, rdx: _payload, r10: plen, r8: ringid)
}

define_syscall! {
    /// Call the [`request_key`] system call in the target process.
    ///
    /// [`request_key`]: https://man7.org/linux/man-pages/man2/request_key.2.html
    request_key(249, rdi: _type_, rsi: _description, rdx: _callout_info, r10: destringid)
}

define_syscall! {
    /// Call the [`keyctl`] system call in the target process.
    ///
    /// [`keyctl`]: https://man7.org/linux/man-pages/man2/keyctl.2.html
    keyctl(250, rdi: option, rsi: arg2, rdx: arg3, r10: arg4, r8: arg5)
}

define_syscall! {
    /// Call the [`ioprio_set`] system call in the target process.
    ///
    /// [`ioprio_set`]: https://man7.org/linux/man-pages/man2/ioprio_set.2.html
    ioprio_set(251, rdi: which, rsi: who, rdx: ioprio)
}

define_syscall! {
    /// Call the [`ioprio_get`] system call in the target process.
    ///
    /// [`ioprio_get`]: https://man7.org/linux/man-pages/man2/ioprio_get.2.html
    ioprio_get(252, rdi: which, rsi: who)
}

define_syscall! {
    /// Call the [`inotify_rm_watch`] system call in the target process.
    ///
    /// [`inotify_rm_watch`]: https://man7.org/linux/man-pages/man2/inotify_rm_watch.2.html
    inotify_rm_watch(255, rdi: fd, rsi: wd)
}

define_syscall! {
    /// Call the [`migrate_pages`] system call in the target process.
    ///
    /// [`migrate_pages`]: https://man7.org/linux/man-pages/man2/migrate_pages.2.html
    migrate_pages(256, rdi: pid, rsi: maxnode, rdx: old_nodes, r10: new_nodes)
}

define_syscall! {
    /// Call the [`openat`] system call in the target process.
    ///
    /// [`openat`]: https://man7.org/linux/man-pages/man2/openat.2.html
    openat(257, rdi: dfd, rsi: filename, rdx: flags, r10: mode)
}

define_syscall! {
    /// Call the [`mkdirat`] system call in the target process.
    ///
    /// [`mkdirat`]: https://man7.org/linux/man-pages/man2/mkdirat.2.html
    mkdirat(258, rdi: dfd, rsi: pathname, rdx: mode)
}

define_syscall! {
    /// Call the [`mknodat`] system call in the target process.
    ///
    /// [`mknodat`]: https://man7.org/linux/man-pages/man2/mknodat.2.html
    mknodat(259, rdi: dfd, rsi: filename, rdx: mode, r10: dev)
}

define_syscall! {
    /// Call the [`fchownat`] system call in the target process.
    ///
    /// [`fchownat`]: https://man7.org/linux/man-pages/man2/fchownat.2.html
    fchownat(260, rdi: dfd, rsi: filename, rdx: user, r10: group, r8: flag)
}

define_syscall! {
    /// Call the [`futimesat`] system call in the target process.
    ///
    /// [`futimesat`]: https://man7.org/linux/man-pages/man2/futimesat.2.html
    futimesat(261, rdi: dfd, rsi: filename, rdx: utimes)
}

define_syscall! {
    /// Call the [`newfstatat`] system call in the target process.
    ///
    /// [`newfstatat`]: https://man7.org/linux/man-pages/man2/newfstatat.2.html
    newfstatat(262, rdi: dfd, rsi: filename, rdx: statbuf, r10: flag)
}

define_syscall! {
    /// Call the [`unlinkat`] system call in the target process.
    ///
    /// [`unlinkat`]: https://man7.org/linux/man-pages/man2/unlinkat.2.html
    unlinkat(263, rdi: dfd, rsi: pathname, rdx: flag)
}

define_syscall! {
    /// Call the [`renameat`] system call in the target process.
    ///
    /// [`renameat`]: https://man7.org/linux/man-pages/man2/renameat.2.html
    renameat(264, rdi: olddfd, rsi: oldname, rdx: newdfd, r10: newname)
}

define_syscall! {
    /// Call the [`linkat`] system call in the target process.
    ///
    /// [`linkat`]: https://man7.org/linux/man-pages/man2/linkat.2.html
    linkat(265, rdi: olddfd, rsi: oldname, rdx: newdfd, r10: newname, r8: flags)
}

define_syscall! {
    /// Call the [`symlinkat`] system call in the target process.
    ///
    /// [`symlinkat`]: https://man7.org/linux/man-pages/man2/symlinkat.2.html
    symlinkat(266, rdi: oldname, rsi: newdfd, rdx: newname)
}

define_syscall! {
    /// Call the [`readlinkat`] system call in the target process.
    ///
    /// [`readlinkat`]: https://man7.org/linux/man-pages/man2/readlinkat.2.html
    readlinkat(267, rdi: dfd, rsi: pathname, rdx: buf, r10: bufsiz)
}

define_syscall! {
    /// Call the [`fchmodat`] system call in the target process.
    ///
    /// [`fchmodat`]: https://man7.org/linux/man-pages/man2/fchmodat.2.html
    fchmodat(268, rdi: dfd, rsi: filename, rdx: mode)
}

define_syscall! {
    /// Call the [`faccessat`] system call in the target process.
    ///
    /// [`faccessat`]: https://man7.org/linux/man-pages/man2/faccessat.2.html
    faccessat(269, rdi: dfd, rsi: filename, rdx: mode)
}

define_syscall! {
    /// Call the [`pselect6`] system call in the target process.
    ///
    /// [`pselect6`]: https://man7.org/linux/man-pages/man2/pselect6.2.html
    pselect6(270, rdi: n, rsi: inp, rdx: outp, r10: exp, r8: tsp, r9: sig)
}

define_syscall! {
    /// Call the [`ppoll`] system call in the target process.
    ///
    /// [`ppoll`]: https://man7.org/linux/man-pages/man2/ppoll.2.html
    ppoll(271, rdi: ufds, rsi: nfds, rdx: tsp, r10: sigmask, r8: sigsetsize)
}

define_syscall! {
    /// Call the [`unshare`] system call in the target process.
    ///
    /// [`unshare`]: https://man7.org/linux/man-pages/man2/unshare.2.html
    unshare(272, rdi: unshare_flags)
}

define_syscall! {
    /// Call the [`set_robust_list`] system call in the target process.
    ///
    /// [`set_robust_list`]: https://man7.org/linux/man-pages/man2/set_robust_list.2.html
    set_robust_list(273, rdi: head, rsi: len)
}

define_syscall! {
    /// Call the [`get_robust_list`] system call in the target process.
    ///
    /// [`get_robust_list`]: https://man7.org/linux/man-pages/man2/get_robust_list.2.html
    get_robust_list(274, rdi: pid, rsi: head_ptr, rdx: len_ptr)
}

define_syscall! {
    /// Call the [`splice`] system call in the target process.
    ///
    /// [`splice`]: https://man7.org/linux/man-pages/man2/splice.2.html
    splice(275, rdi: fd_in, rsi: off_in, rdx: fd_out, r10: off_out, r8: len, r9: flags)
}

define_syscall! {
    /// Call the [`tee`] system call in the target process.
    ///
    /// [`tee`]: https://man7.org/linux/man-pages/man2/tee.2.html
    tee(276, rdi: fdin, rsi: fdout, rdx: len, r10: flags)
}

define_syscall! {
    /// Call the [`sync_file_range`] system call in the target process.
    ///
    /// [`sync_file_range`]: https://man7.org/linux/man-pages/man2/sync_file_range.2.html
    sync_file_range(277, rdi: fd, rsi: offset, rdx: nbytes, r10: flags)
}

define_syscall! {
    /// Call the [`vmsplice`] system call in the target process.
    ///
    /// [`vmsplice`]: https://man7.org/linux/man-pages/man2/vmsplice.2.html
    vmsplice(278, rdi: fd, rsi: iov, rdx: nr_segs, r10: flags)
}

define_syscall! {
    /// Call the [`move_pages`] system call in the target process.
    ///
    /// [`move_pages`]: https://man7.org/linux/man-pages/man2/move_pages.2.html
    move_pages(279, rdi: pid, rsi: nr_pages, rdx: pages, r10: nodes, r8: status, r9: flags)
}

define_syscall! {
    /// Call the [`utimensat`] system call in the target process.
    ///
    /// [`utimensat`]: https://man7.org/linux/man-pages/man2/utimensat.2.html
    utimensat(280, rdi: dfd, rsi: filename, rdx: utimes, r10: flags)
}

define_syscall! {
    /// Call the [`epoll_pwait`] system call in the target process.
    ///
    /// [`epoll_pwait`]: https://man7.org/linux/man-pages/man2/epoll_pwait.2.html
    epoll_pwait(281, rdi: epfd, rsi: events, rdx: maxevents, r10: timeout, r8: sigmask, r9: sigsetsize)
}

define_syscall! {
    /// Call the [`signalfd`] system call in the target process.
    ///
    /// [`signalfd`]: https://man7.org/linux/man-pages/man2/signalfd.2.html
    signalfd(282, rdi: ufd, rsi: user_mask, rdx: sizemask)
}

define_syscall! {
    /// Call the [`timerfd_create`] system call in the target process.
    ///
    /// [`timerfd_create`]: https://man7.org/linux/man-pages/man2/timerfd_create.2.html
    timerfd_create(283, rdi: clockid, rsi: flags)
}

define_syscall! {
    /// Call the [`eventfd`] system call in the target process.
    ///
    /// [`eventfd`]: https://man7.org/linux/man-pages/man2/eventfd.2.html
    eventfd(284, rdi: count)
}

define_syscall! {
    /// Call the [`fallocate`] system call in the target process.
    ///
    /// [`fallocate`]: https://man7.org/linux/man-pages/man2/fallocate.2.html
    fallocate(285, rdi: fd, rsi: mode, rdx: offset, r10: len)
}

define_syscall! {
    /// Call the [`timerfd_settime`] system call in the target process.
    ///
    /// [`timerfd_settime`]: https://man7.org/linux/man-pages/man2/timerfd_settime.2.html
    timerfd_settime(286, rdi: ufd, rsi: flags, rdx: utmr, r10: otmr)
}

define_syscall! {
    /// Call the [`timerfd_gettime`] system call in the target process.
    ///
    /// [`timerfd_gettime`]: https://man7.org/linux/man-pages/man2/timerfd_gettime.2.html
    timerfd_gettime(287, rdi: ufd, rsi: otmr)
}

define_syscall! {
    /// Call the [`accept4`] system call in the target process.
    ///
    /// [`accept4`]: https://man7.org/linux/man-pages/man2/accept4.2.html
    accept4(288, rdi: fd, rsi: upeer_sockaddr, rdx: upeer_addrlen, r10: flags)
}

define_syscall! {
    /// Call the [`signalfd4`] system call in the target process.
    ///
    /// [`signalfd4`]: https://man7.org/linux/man-pages/man2/signalfd4.2.html
    signalfd4(289, rdi: ufd, rsi: user_mask, rdx: sizemask, r10: flags)
}

define_syscall! {
    /// Call the [`eventfd2`] system call in the target process.
    ///
    /// [`eventfd2`]: https://man7.org/linux/man-pages/man2/eventfd2.2.html
    eventfd2(290, rdi: count, rsi: flags)
}

define_syscall! {
    /// Call the [`epoll_create1`] system call in the target process.
    ///
    /// [`epoll_create1`]: https://man7.org/linux/man-pages/man2/epoll_create1.2.html
    epoll_create1(291, rdi: flags)
}

define_syscall! {
    /// Call the [`dup3`] system call in the target process.
    ///
    /// [`dup3`]: https://man7.org/linux/man-pages/man2/dup3.2.html
    dup3(292, rdi: oldfd, rsi: newfd, rdx: flags)
}

define_syscall! {
    /// Call the [`pipe2`] system call in the target process.
    ///
    /// [`pipe2`]: https://man7.org/linux/man-pages/man2/pipe2.2.html
    pipe2(293, rdi: fildes, rsi: flags)
}

define_syscall! {
    /// Call the [`inotify_init1`] system call in the target process.
    ///
    /// [`inotify_init1`]: https://man7.org/linux/man-pages/man2/inotify_init1.2.html
    inotify_init1(294, rdi: flags)
}

define_syscall! {
    /// Call the [`preadv`] system call in the target process.
    ///
    /// [`preadv`]: https://man7.org/linux/man-pages/man2/preadv.2.html
    preadv(295, rdi: fd, rsi: vec, rdx: vlen, r10: pos_l, r8: pos_h)
}

define_syscall! {
    /// Call the [`pwritev`] system call in the target process.
    ///
    /// [`pwritev`]: https://man7.org/linux/man-pages/man2/pwritev.2.html
    pwritev(296, rdi: fd, rsi: vec, rdx: vlen, r10: pos_l, r8: pos_h)
}

define_syscall! {
    /// Call the [`rt_tgsigqueueinfo`] system call in the target process.
    ///
    /// [`rt_tgsigqueueinfo`]: https://man7.org/linux/man-pages/man2/rt_tgsigqueueinfo.2.html
    rt_tgsigqueueinfo(297, rdi: tgid, rsi: pid, rdx: sig, r10: uinfo)
}

define_syscall! {
    /// Call the [`perf_event_open`] system call in the target process.
    ///
    /// [`perf_event_open`]: https://man7.org/linux/man-pages/man2/perf_event_open.2.html
    perf_event_open(298, rdi: attr_uptr, rsi: pid, rdx: cpu, r10: group_fd, r8: flags)
}

define_syscall! {
    /// Call the [`recvmmsg`] system call in the target process.
    ///
    /// [`recvmmsg`]: https://man7.org/linux/man-pages/man2/recvmmsg.2.html
    recvmmsg(299, rdi: fd, rsi: mmsg, rdx: vlen, r10: flags, r8: timeout)
}

define_syscall! {
    /// Call the [`fanotify_init`] system call in the target process.
    ///
    /// [`fanotify_init`]: https://man7.org/linux/man-pages/man2/fanotify_init.2.html
    fanotify_init(300, rdi: flags, rsi: event_f_flags)
}

define_syscall! {
    /// Call the [`fanotify_mark`] system call in the target process.
    ///
    /// [`fanotify_mark`]: https://man7.org/linux/man-pages/man2/fanotify_mark.2.html
    fanotify_mark(301, rdi: fanotify_fd, rsi: flags, rdx: mask, r10: dfd, r8: pathname)
}

define_syscall! {
    /// Call the [`prlimit64`] system call in the target process.
    ///
    /// [`prlimit64`]: https://man7.org/linux/man-pages/man2/prlimit64.2.html
    prlimit64(302, rdi: pid, rsi: resource, rdx: new_rlim, r10: old_rlim)
}

define_syscall! {
    /// Call the [`name_to_handle_at`] system call in the target process.
    ///
    /// [`name_to_handle_at`]: https://man7.org/linux/man-pages/man2/name_to_handle_at.2.html
    name_to_handle_at(303, rdi: dfd, rsi: name, rdx: handle, r10: mnt_id, r8: flag)
}

define_syscall! {
    /// Call the [`open_by_handle_at`] system call in the target process.
    ///
    /// [`open_by_handle_at`]: https://man7.org/linux/man-pages/man2/open_by_handle_at.2.html
    open_by_handle_at(304, rdi: mountdirfd, rsi: handle, rdx: flags)
}

define_syscall! {
    /// Call the [`clock_adjtime`] system call in the target process.
    ///
    /// [`clock_adjtime`]: https://man7.org/linux/man-pages/man2/clock_adjtime.2.html
    clock_adjtime(305, rdi: which_clock, rsi: utx)
}

define_syscall! {
    /// Call the [`syncfs`] system call in the target process.
    ///
    /// [`syncfs`]: https://man7.org/linux/man-pages/man2/syncfs.2.html
    syncfs(306, rdi: fd)
}

define_syscall! {
    /// Call the [`sendmmsg`] system call in the target process.
    ///
    /// [`sendmmsg`]: https://man7.org/linux/man-pages/man2/sendmmsg.2.html
    sendmmsg(307, rdi: fd, rsi: mmsg, rdx: vlen, r10: flags)
}

define_syscall! {
    /// Call the [`setns`] system call in the target process.
    ///
    /// [`setns`]: https://man7.org/linux/man-pages/man2/setns.2.html
    setns(308, rdi: fd, rsi: nstype_)
}

define_syscall! {
    /// Call the [`getcpu`] system call in the target process.
    ///
    /// [`getcpu`]: https://man7.org/linux/man-pages/man2/getcpu.2.html
    getcpu(309, rdi: cpup, rsi: nodep, rdx: unused)
}

define_syscall! {
    /// Call the [`process_vm_readv`] system call in the target process.
    ///
    /// [`process_vm_readv`]: https://man7.org/linux/man-pages/man2/process_vm_readv.2.html
    process_vm_readv(310, rdi: pid, rsi: lvec, rdx: liovcnt, r10: rvec, r8: riovcnt, r9: flags)
}

define_syscall! {
    /// Call the [`process_vm_writev`] system call in the target process.
    ///
    /// [`process_vm_writev`]: https://man7.org/linux/man-pages/man2/process_vm_writev.2.html
    process_vm_writev(311, rdi: pid, rsi: lvec, rdx: liovcnt, r10: rvec, r8: riovcnt, r9: flags)
}

define_syscall! {
    /// Call the [`kcmp`] system call in the target process.
    ///
    /// [`kcmp`]: https://man7.org/linux/man-pages/man2/kcmp.2.html
    kcmp(312, rdi: pid1, rsi: pid2, rdx: type_, r10: idx1, r8: idx2)
}

define_syscall! {
    /// Call the [`finit_module`] system call in the target process.
    ///
    /// [`finit_module`]: https://man7.org/linux/man-pages/man2/finit_module.2.html
    finit_module(313, rdi: fd, rsi: uargs, rdx: flags)
}

#[cfg(test)]
mod tests {
    use anyhow::Error as AnyError;

    use crate::process::spawn_process;

    use super::*;

    #[allow(clippy::cast_sign_loss)]
    #[test]
    fn remote_mmap() -> Result<(), AnyError> {
        let target = spawn_process("/bin/ls", ["-a"])?;
        let mut ctrl = target.wait()?.assume_alive()?;

        // The remote process' mmap will interpret it correctly, the binary representation stays the
        // same.
        let minus1 = -1_i64 as u64;

        let map_addr = mmap(&mut ctrl, 0, 0x1000, 0o777, 0x20, minus1, 0)?;

        assert_ne!(minus1, map_addr);
        Ok(())
    }
}