aboutsummaryrefslogtreecommitdiff
path: root/gdb/riscv-canonicalize-syscall-gen.c
blob: 67e5410dc6d1f975ec389aad3b124a92c80f6537 (plain)
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
/* DO NOT EDIT: Autogenerated by riscv-canonicalize-syscall-gen.py

   Copyright (C) 2024-2025 Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#include "defs.h"
#include "riscv-linux-tdep.h"

/* riscv64_canonicalize_syscall maps from the native riscv 64 Linux set
   of syscall ids into a canonical set of syscall ids used by
   process record.  */

enum gdb_syscall
riscv64_canonicalize_syscall (int syscall)
{
  switch (syscall)
    {
    case 0: return gdb_sys_io_setup;
    case 1: return gdb_sys_io_destroy;
    case 2: return gdb_sys_io_submit;
    case 3: return gdb_sys_io_cancel;
    case 4: return gdb_sys_io_getevents;
    case 5: return gdb_sys_setxattr;
    case 6: return gdb_sys_lsetxattr;
    case 7: return gdb_sys_fsetxattr;
    case 8: return gdb_sys_getxattr;
    case 9: return gdb_sys_lgetxattr;
    case 10: return gdb_sys_fgetxattr;
    case 11: return gdb_sys_listxattr;
    case 12: return gdb_sys_llistxattr;
    case 13: return gdb_sys_flistxattr;
    case 14: return gdb_sys_removexattr;
    case 15: return gdb_sys_lremovexattr;
    case 16: return gdb_sys_fremovexattr;
    case 17: return gdb_sys_getcwd;
    case 18: return gdb_sys_lookup_dcookie;
    case 19: return gdb_sys_eventfd2;
    case 20: return gdb_sys_epoll_create1;
    case 21: return gdb_sys_epoll_ctl;
    case 22: return gdb_sys_epoll_pwait;
    case 23: return gdb_sys_dup;
    case 24: return gdb_sys_dup3;
    case 25: return gdb_sys_fcntl;
    case 26: return gdb_sys_inotify_init1;
    case 27: return gdb_sys_inotify_add_watch;
    case 28: return gdb_sys_inotify_rm_watch;
    case 29: return gdb_sys_ioctl;
    case 30: return gdb_sys_ioprio_set;
    case 31: return gdb_sys_ioprio_get;
    case 32: return gdb_sys_flock;
    case 33: return gdb_sys_mknodat;
    case 34: return gdb_sys_mkdirat;
    case 35: return gdb_sys_unlinkat;
    case 36: return gdb_sys_symlinkat;
    case 37: return gdb_sys_linkat;
    /* case 39: return gdb_sys_umount2;  */
    case 40: return gdb_sys_mount;
    case 41: return gdb_sys_pivot_root;
    case 42: return gdb_sys_nfsservctl;
    case 43: return gdb_sys_statfs;
    case 44: return gdb_sys_fstatfs;
    case 45: return gdb_sys_truncate;
    case 46: return gdb_sys_ftruncate;
    case 47: return gdb_sys_fallocate;
    case 48: return gdb_sys_faccessat;
    case 49: return gdb_sys_chdir;
    case 50: return gdb_sys_fchdir;
    case 51: return gdb_sys_chroot;
    case 52: return gdb_sys_fchmod;
    case 53: return gdb_sys_fchmodat;
    case 54: return gdb_sys_fchownat;
    case 55: return gdb_sys_fchown;
    case 56: return gdb_sys_openat;
    case 57: return gdb_sys_close;
    case 58: return gdb_sys_vhangup;
    case 59: return gdb_sys_pipe2;
    case 60: return gdb_sys_quotactl;
    case 61: return gdb_sys_getdents64;
    case 62: return gdb_sys_lseek;
    case 63: return gdb_sys_read;
    case 64: return gdb_sys_write;
    case 65: return gdb_sys_readv;
    case 66: return gdb_sys_writev;
    case 67: return gdb_sys_pread64;
    case 68: return gdb_sys_pwrite64;
    /* case 69: return gdb_sys_preadv;  */
    /* case 70: return gdb_sys_pwritev;  */
    case 71: return gdb_sys_sendfile;
    case 72: return gdb_sys_pselect6;
    case 73: return gdb_sys_ppoll;
    /* case 74: return gdb_sys_signalfd4;  */
    case 75: return gdb_sys_vmsplice;
    case 76: return gdb_sys_splice;
    case 77: return gdb_sys_tee;
    case 78: return gdb_sys_readlinkat;
    case 79: return gdb_sys_newfstatat;
    case 80: return gdb_sys_fstat;
    case 81: return gdb_sys_sync;
    case 82: return gdb_sys_fsync;
    case 83: return gdb_sys_fdatasync;
    case 84: return gdb_sys_sync_file_range;
    /* case 85: return gdb_sys_timerfd_create;  */
    /* case 86: return gdb_sys_timerfd_settime;  */
    /* case 87: return gdb_sys_timerfd_gettime;  */
    /* case 88: return gdb_sys_utimensat;  */
    case 89: return gdb_sys_acct;
    case 90: return gdb_sys_capget;
    case 91: return gdb_sys_capset;
    case 92: return gdb_sys_personality;
    case 93: return gdb_sys_exit;
    case 94: return gdb_sys_exit_group;
    case 95: return gdb_sys_waitid;
    case 96: return gdb_sys_set_tid_address;
    case 97: return gdb_sys_unshare;
    case 98: return gdb_sys_futex;
    case 99: return gdb_sys_set_robust_list;
    case 100: return gdb_sys_get_robust_list;
    case 101: return gdb_sys_nanosleep;
    case 102: return gdb_sys_getitimer;
    case 103: return gdb_sys_setitimer;
    case 104: return gdb_sys_kexec_load;
    case 105: return gdb_sys_init_module;
    case 106: return gdb_sys_delete_module;
    case 107: return gdb_sys_timer_create;
    case 108: return gdb_sys_timer_gettime;
    case 109: return gdb_sys_timer_getoverrun;
    case 110: return gdb_sys_timer_settime;
    case 111: return gdb_sys_timer_delete;
    case 112: return gdb_sys_clock_settime;
    case 113: return gdb_sys_clock_gettime;
    case 114: return gdb_sys_clock_getres;
    case 115: return gdb_sys_clock_nanosleep;
    case 116: return gdb_sys_syslog;
    case 117: return gdb_sys_ptrace;
    case 118: return gdb_sys_sched_setparam;
    case 119: return gdb_sys_sched_setscheduler;
    case 120: return gdb_sys_sched_getscheduler;
    case 121: return gdb_sys_sched_getparam;
    case 122: return gdb_sys_sched_setaffinity;
    case 123: return gdb_sys_sched_getaffinity;
    case 124: return gdb_sys_sched_yield;
    case 125: return gdb_sys_sched_get_priority_max;
    case 126: return gdb_sys_sched_get_priority_min;
    case 127: return gdb_sys_sched_rr_get_interval;
    case 128: return gdb_sys_restart_syscall;
    case 129: return gdb_sys_kill;
    case 130: return gdb_sys_tkill;
    case 131: return gdb_sys_tgkill;
    case 132: return gdb_sys_sigaltstack;
    case 133: return gdb_sys_rt_sigsuspend;
    case 134: return gdb_sys_rt_sigaction;
    case 135: return gdb_sys_rt_sigprocmask;
    case 136: return gdb_sys_rt_sigpending;
    case 137: return gdb_sys_rt_sigtimedwait;
    case 138: return gdb_sys_rt_sigqueueinfo;
    case 139: return gdb_sys_rt_sigreturn;
    case 140: return gdb_sys_setpriority;
    case 141: return gdb_sys_getpriority;
    case 142: return gdb_sys_reboot;
    case 143: return gdb_sys_setregid;
    case 144: return gdb_sys_setgid;
    case 145: return gdb_sys_setreuid;
    case 146: return gdb_sys_setuid;
    case 147: return gdb_sys_setresuid;
    case 148: return gdb_sys_getresuid;
    case 149: return gdb_sys_setresgid;
    case 150: return gdb_sys_getresgid;
    case 151: return gdb_sys_setfsuid;
    case 152: return gdb_sys_setfsgid;
    case 153: return gdb_sys_times;
    case 154: return gdb_sys_setpgid;
    case 155: return gdb_sys_getpgid;
    case 156: return gdb_sys_getsid;
    case 157: return gdb_sys_setsid;
    case 158: return gdb_sys_getgroups;
    case 159: return gdb_sys_setgroups;
    case 160: return gdb_sys_uname;
    case 161: return gdb_sys_sethostname;
    case 162: return gdb_sys_setdomainname;
    case 163: return gdb_sys_getrlimit;
    case 164: return gdb_sys_setrlimit;
    case 165: return gdb_sys_getrusage;
    case 166: return gdb_sys_umask;
    case 167: return gdb_sys_prctl;
    case 168: return gdb_sys_getcpu;
    case 169: return gdb_sys_gettimeofday;
    case 170: return gdb_sys_settimeofday;
    case 171: return gdb_sys_adjtimex;
    case 172: return gdb_sys_getpid;
    case 173: return gdb_sys_getppid;
    case 174: return gdb_sys_getuid;
    case 175: return gdb_sys_geteuid;
    case 176: return gdb_sys_getgid;
    case 177: return gdb_sys_getegid;
    case 178: return gdb_sys_gettid;
    case 179: return gdb_sys_sysinfo;
    case 180: return gdb_sys_mq_open;
    case 181: return gdb_sys_mq_unlink;
    case 182: return gdb_sys_mq_timedsend;
    case 183: return gdb_sys_mq_timedreceive;
    case 184: return gdb_sys_mq_notify;
    case 185: return gdb_sys_mq_getsetattr;
    case 186: return gdb_sys_msgget;
    case 187: return gdb_sys_msgctl;
    case 188: return gdb_sys_msgrcv;
    case 189: return gdb_sys_msgsnd;
    case 190: return gdb_sys_semget;
    case 191: return gdb_sys_semctl;
    case 192: return gdb_sys_semtimedop;
    case 193: return gdb_sys_semop;
    case 194: return gdb_sys_shmget;
    case 195: return gdb_sys_shmctl;
    case 196: return gdb_sys_shmat;
    case 197: return gdb_sys_shmdt;
    case 198: return gdb_sys_socket;
    case 199: return gdb_sys_socketpair;
    case 200: return gdb_sys_bind;
    case 201: return gdb_sys_listen;
    case 202: return gdb_sys_accept;
    case 203: return gdb_sys_connect;
    case 204: return gdb_sys_getsockname;
    case 205: return gdb_sys_getpeername;
    case 206: return gdb_sys_sendto;
    case 207: return gdb_sys_recvfrom;
    case 208: return gdb_sys_setsockopt;
    case 209: return gdb_sys_getsockopt;
    case 210: return gdb_sys_shutdown;
    case 211: return gdb_sys_sendmsg;
    case 212: return gdb_sys_recvmsg;
    case 213: return gdb_sys_readahead;
    case 214: return gdb_sys_brk;
    case 215: return gdb_sys_munmap;
    case 216: return gdb_sys_mremap;
    case 217: return gdb_sys_add_key;
    case 218: return gdb_sys_request_key;
    case 219: return gdb_sys_keyctl;
    case 220: return gdb_sys_clone;
    case 221: return gdb_sys_execve;
    case 222: return gdb_sys_old_mmap;
    case 223: return gdb_sys_fadvise64;
    case 224: return gdb_sys_swapon;
    case 225: return gdb_sys_swapoff;
    case 226: return gdb_sys_mprotect;
    case 227: return gdb_sys_msync;
    case 228: return gdb_sys_mlock;
    case 229: return gdb_sys_munlock;
    case 230: return gdb_sys_mlockall;
    case 231: return gdb_sys_munlockall;
    case 232: return gdb_sys_mincore;
    case 233: return gdb_sys_madvise;
    case 234: return gdb_sys_remap_file_pages;
    case 235: return gdb_sys_mbind;
    case 236: return gdb_sys_get_mempolicy;
    case 237: return gdb_sys_set_mempolicy;
    case 238: return gdb_sys_migrate_pages;
    case 239: return gdb_sys_move_pages;
    /* case 240: return gdb_sys_rt_tgsigqueueinfo;  */
    /* case 241: return gdb_sys_perf_event_open;  */
    case 242: return gdb_sys_accept4;
    /* case 243: return gdb_sys_recvmmsg;  */
    /* case 258: return gdb_sys_riscv_hwprobe;  */
    /* case 259: return gdb_sys_riscv_flush_icache;  */
    case 260: return gdb_sys_wait4;
    /* case 261: return gdb_sys_prlimit64;  */
    /* case 262: return gdb_sys_fanotify_init;  */
    /* case 263: return gdb_sys_fanotify_mark;  */
    /* case 264: return gdb_sys_name_to_handle_at;  */
    /* case 265: return gdb_sys_open_by_handle_at;  */
    /* case 266: return gdb_sys_clock_adjtime;  */
    /* case 267: return gdb_sys_syncfs;  */
    /* case 268: return gdb_sys_setns;  */
    /* case 269: return gdb_sys_sendmmsg;  */
    /* case 270: return gdb_sys_process_vm_readv;  */
    /* case 271: return gdb_sys_process_vm_writev;  */
    /* case 272: return gdb_sys_kcmp;  */
    /* case 273: return gdb_sys_finit_module;  */
    /* case 274: return gdb_sys_sched_setattr;  */
    /* case 275: return gdb_sys_sched_getattr;  */
    /* case 276: return gdb_sys_renameat2;  */
    /* case 277: return gdb_sys_seccomp;  */
    case 278: return gdb_sys_getrandom;
    /* case 279: return gdb_sys_memfd_create;  */
    /* case 280: return gdb_sys_bpf;  */
    /* case 281: return gdb_sys_execveat;  */
    /* case 282: return gdb_sys_userfaultfd;  */
    /* case 283: return gdb_sys_membarrier;  */
    /* case 284: return gdb_sys_mlock2;  */
    /* case 285: return gdb_sys_copy_file_range;  */
    /* case 286: return gdb_sys_preadv2;  */
    /* case 287: return gdb_sys_pwritev2;  */
    /* case 288: return gdb_sys_pkey_mprotect;  */
    /* case 289: return gdb_sys_pkey_alloc;  */
    /* case 290: return gdb_sys_pkey_free;  */
    case 291: return gdb_sys_statx;
    /* case 292: return gdb_sys_io_pgetevents;  */
    /* case 293: return gdb_sys_rseq;  */
    /* case 294: return gdb_sys_kexec_file_load;  */
    /* case 424: return gdb_sys_pidfd_send_signal;  */
    /* case 425: return gdb_sys_io_uring_setup;  */
    /* case 426: return gdb_sys_io_uring_enter;  */
    /* case 427: return gdb_sys_io_uring_register;  */
    /* case 428: return gdb_sys_open_tree;  */
    /* case 429: return gdb_sys_move_mount;  */
    /* case 430: return gdb_sys_fsopen;  */
    /* case 431: return gdb_sys_fsconfig;  */
    /* case 432: return gdb_sys_fsmount;  */
    /* case 433: return gdb_sys_fspick;  */
    /* case 434: return gdb_sys_pidfd_open;  */
    /* case 435: return gdb_sys_clone3;  */
    /* case 436: return gdb_sys_close_range;  */
    /* case 437: return gdb_sys_openat2;  */
    /* case 438: return gdb_sys_pidfd_getfd;  */
    /* case 439: return gdb_sys_faccessat2;  */
    /* case 440: return gdb_sys_process_madvise;  */
    /* case 441: return gdb_sys_epoll_pwait2;  */
    /* case 442: return gdb_sys_mount_setattr;  */
    /* case 443: return gdb_sys_quotactl_fd;  */
    /* case 444: return gdb_sys_landlock_create_ruleset;  */
    /* case 445: return gdb_sys_landlock_add_rule;  */
    /* case 446: return gdb_sys_landlock_restrict_self;  */
    /* case 447: return gdb_sys_memfd_secret;  */
    /* case 448: return gdb_sys_process_mrelease;  */
    /* case 449: return gdb_sys_futex_waitv;  */
    /* case 450: return gdb_sys_set_mempolicy_home_node;  */
    /* case 451: return gdb_sys_cachestat;  */
    /* case 452: return gdb_sys_fchmodat2;  */
    /* case 453: return gdb_sys_map_shadow_stack;  */
    /* case 454: return gdb_sys_futex_wake;  */
    /* case 455: return gdb_sys_futex_wait;  */
    /* case 456: return gdb_sys_futex_requeue;  */
    /* case 457: return gdb_sys_statmount;  */
    /* case 458: return gdb_sys_listmount;  */
    /* case 459: return gdb_sys_lsm_get_self_attr;  */
    /* case 460: return gdb_sys_lsm_set_self_attr;  */
    /* case 461: return gdb_sys_lsm_list_modules;  */
    /* case 462: return gdb_sys_mseal;  */
    /* case 463: return gdb_sys_setxattrat;  */
    /* case 464: return gdb_sys_getxattrat;  */
    /* case 465: return gdb_sys_listxattrat;  */
    /* case 466: return gdb_sys_removexattrat;  */
    default:
      return gdb_sys_no_syscall;
    }
}