gem5 v24.1.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
syscall_tbl32.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Arm Limited
3 *
4 * The license below extends only to copyright in the software and shall
5 * not be construed as granting a license to any other intellectual
6 * property including but not limited to intellectual property relating
7 * to a hardware implementation of the functionality of the software
8 * licensed hereunder. You may use the software subject to the license
9 * terms below provided that you ensure that this notice is replicated
10 * unmodified and in its entirety in all distributions of the software,
11 * modified or unmodified, in source code or in binary form.
12 *
13 * Copyright 2020 Google Inc.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are
17 * met: redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer;
19 * redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution;
22 * neither the name of the copyright holders nor the names of its
23 * contributors may be used to endorse or promote products derived from
24 * this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 */
38
39#include <sys/syscall.h>
40
44#include "sim/syscall_emul.hh"
45
46namespace gem5
47{
48
49namespace X86ISA
50{
51
52SyscallDescTable<EmuLinux::SyscallABI32> EmuLinux::syscallDescs32 = {
53 { 0, "restart_syscall" },
54 { 1, "exit", exitFunc },
55 { 2, "fork" },
56 { 3, "read", readFunc<X86Linux32> },
57 { 4, "write", writeFunc<X86Linux32> },
58 { 5, "open", openFunc<X86Linux32> },
59 { 6, "close", closeFunc },
60 { 7, "waitpid" },
61 { 8, "creat" },
62 { 9, "link" },
63 { 10, "unlink" },
64 { 11, "execve", execveFunc<X86Linux32> },
65 { 12, "chdir", chdirFunc },
66 { 13, "time", timeFunc<X86Linux32> },
67 { 14, "mknod", mknodFunc },
68 { 15, "chmod" },
69 { 16, "lchown" },
70 { 17, "break" },
71 { 18, "oldstat" },
72 { 19, "lseek", lseekFunc<X86Linux32> },
73 { 20, "getpid", getpidFunc },
74 { 21, "mount" },
75 { 22, "umount" },
76 { 23, "setuid" },
77 { 24, "getuid", getuidFunc },
78 { 25, "stime" },
79 { 26, "ptrace" },
80 { 27, "alarm" },
81 { 28, "oldfstat" },
82 { 29, "pause" },
83 { 30, "utime" },
84 { 31, "stty" },
85 { 32, "gtty" },
86 { 33, "access", ignoreFunc },
87 { 34, "nice" },
88 { 35, "ftime" },
89 { 36, "sync" },
90 { 37, "kill" },
91 { 38, "rename" },
92 { 39, "mkdir", mkdirFunc },
93 { 40, "rmdir", mkdirFunc },
94 { 41, "dup", dupFunc },
95 { 42, "pipe", pipeFunc },
96 { 43, "times", timesFunc<X86Linux32> },
97 { 44, "prof" },
98 { 45, "brk", brkFunc },
99 { 46, "setgid" },
100 { 47, "getgid", getgidFunc },
101 { 48, "signal" },
102 { 49, "geteuid", geteuidFunc },
103 { 50, "getegid", getegidFunc },
104 { 51, "acct" },
105 { 52, "umount2" },
106 { 53, "lock" },
107 { 54, "ioctl", ioctlFunc<X86Linux32> },
108 { 55, "fcntl", fcntlFunc },
109 { 56, "mpx" },
110 { 57, "setpgid", setpgidFunc },
111 { 58, "ulimit" },
112 { 59, "oldolduname" },
113 { 60, "umask", umaskFunc },
114 { 61, "chroot" },
115 { 62, "ustat" },
116 { 63, "dup2", dup2Func },
117 { 64, "getppid" },
118 { 65, "getpgrp" },
119 { 66, "setsid" },
120 { 67, "sigaction" },
121 { 68, "sgetmask" },
122 { 69, "ssetmask" },
123 { 70, "setreuid" },
124 { 71, "setregid" },
125 { 72, "sigsuspend" },
126 { 73, "sigpending" },
127 { 74, "sethostname" },
128 { 75, "setrlimit", ignoreFunc },
129 { 76, "getrlimit", getrlimitFunc<X86Linux32> },
130 { 77, "getrusage", getrusageFunc<X86Linux32> },
131 { 78, "gettimeofday" },
132 { 79, "settimeofday" },
133 { 80, "getgroups" },
134 { 81, "setgroups" },
135 { 82, "select", selectFunc<X86Linux32> },
136 { 83, "symlink" },
137 { 84, "oldlstat" },
138 { 85, "readlink", readlinkFunc<X86Linux32> },
139 { 86, "uselib" },
140 { 87, "swapon" },
141 { 88, "reboot" },
142 { 89, "readdir" },
143 { 90, "mmap" },
144 { 91, "munmap", munmapFunc<X86Linux32> },
145 { 92, "truncate", truncateFunc<X86Linux32> },
146 { 93, "ftruncate", ftruncateFunc<X86Linux32> },
147 { 94, "fchmod" },
148 { 95, "fchown" },
149 { 96, "getpriority" },
150 { 97, "setpriority", ignoreFunc },
151 { 98, "profil" },
152 { 99, "statfs", ignoreFunc },
153 { 100, "fstatfs" },
154 { 101, "ioperm" },
155 { 102, "socketcall" },
156 { 103, "syslog" },
157 { 104, "setitimer" },
158 { 105, "getitimer" },
159 { 106, "stat" },
160 { 107, "lstat" },
161 { 108, "fstat" },
162 { 109, "olduname" },
163 { 110, "iopl" },
164 { 111, "vhangup" },
165 { 112, "idle" },
166 { 113, "vm86old" },
167 { 114, "wait4", wait4Func<X86Linux32> },
168 { 115, "swapoff" },
169 { 116, "sysinfo", sysinfoFunc<X86Linux32> },
170 { 117, "ipc" },
171 { 118, "fsync" },
172 { 119, "sigreturn" },
173 { 120, "clone", cloneFunc<X86Linux32> },
174 { 121, "setdomainname" },
175 { 122, "uname", unameFunc },
176 { 123, "modify_ldt" },
177 { 124, "adjtimex" },
178 { 125, "mprotect", ignoreFunc },
179 { 126, "sigprocmask" },
180 { 127, "create_module" },
181 { 128, "init_module" },
182 { 129, "delete_module" },
183 { 130, "get_kernel_syms" },
184 { 131, "quotactl" },
185 { 132, "getpgid" },
186 { 133, "fchdir" },
187 { 134, "bdflush" },
188 { 135, "sysfs" },
189 { 136, "personality" },
190 { 137, "afs_syscall" },
191 { 138, "setfsuid" },
192 { 139, "setfsgid" },
193 { 140, "_llseek", _llseekFunc },
194#if defined(SYS_getdents)
195 { 141, "getdents", getdentsFunc },
196#else
197 { 141, "getdents" },
198#endif
199 { 142, "_newselect" },
200 { 143, "flock" },
201 { 144, "msync" },
202 { 145, "readv", readvFunc<X86Linux32> },
203 { 146, "writev", writevFunc<X86Linux32> },
204 { 147, "getsid" },
205 { 148, "fdatasync" },
206 { 149, "_sysctl" },
207 { 150, "mlock" },
208 { 151, "munlock" },
209 { 152, "mlockall" },
210 { 153, "munlockall" },
211 { 154, "sched_setparam" },
212 { 155, "sched_getparam" },
213 { 156, "sched_setscheduler" },
214 { 157, "sched_getscheduler" },
215 { 158, "sched_yield", ignoreFunc },
216 { 159, "sched_get_priority_max" },
217 { 160, "sched_get_priority_min" },
218 { 161, "sched_rr_get_interval" },
219 { 162, "nanosleep", ignoreFunc },
220 { 163, "mremap" },
221 { 164, "setresuid", ignoreFunc },
222 { 165, "getresuid" },
223 { 166, "vm86" },
224 { 167, "query_module" },
225 { 168, "poll", pollFunc<X86Linux32> },
226 { 169, "nfsservctl" },
227 { 170, "setresgid" },
228 { 171, "getresgid" },
229 { 172, "prctl" },
230 { 173, "rt_sigreturn" },
231 { 174, "rt_sigaction", ignoreFunc },
232 { 175, "rt_sigprocmask", ignoreFunc },
233 { 176, "rt_sigpending" },
234 { 177, "rt_sigtimedwait" },
235 { 178, "rt_sigqueueinfo" },
236 { 179, "rt_sigsuspend" },
237 { 180, "pread64", pread64Func<X86Linux64> },
238 { 181, "pwrite64", pwrite64Func<X86Linux64> },
239 { 182, "chown" },
240 { 183, "getcwd", getcwdFunc<X86Linux32> },
241 { 184, "capget" },
242 { 185, "capset" },
243 { 186, "sigaltstack" },
244 { 187, "sendfile" },
245 { 188, "getpmsg" },
246 { 189, "putpmsg" },
247 { 190, "vfork" },
248 { 191, "ugetrlimit", ignoreFunc },
249 { 192, "mmap2", mmap2Func<X86Linux32> },
250 { 193, "truncate64", truncate64Func },
251 { 194, "ftruncate64", ftruncate64Func },
252 { 195, "stat64", stat64Func<X86Linux32> },
253 { 196, "lstat64" },
254 { 197, "fstat64", fstat64Func<X86Linux32> },
255 { 198, "lchown32" },
256 { 199, "getuid32", getuidFunc },
257 { 200, "getgid32", getgidFunc },
258 { 201, "geteuid32", geteuidFunc },
259 { 202, "getegid32", getegidFunc },
260 { 203, "setreuid32" },
261 { 204, "setregid32" },
262 { 205, "getgroups32" },
263 { 206, "setgroups32" },
264 { 207, "fchown32" },
265 { 208, "setresuid32" },
266 { 209, "getresuid32" },
267 { 210, "setresgid32" },
268 { 211, "getresgid32" },
269 { 212, "chown32" },
270 { 213, "setuid32" },
271 { 214, "setgid32" },
272 { 215, "setfsuid32" },
273 { 216, "setfsgid32" },
274 { 217, "pivot_root" },
275 { 218, "mincore" },
276 { 219, "madvise", ignoreFunc },
277 { 220, "madvise1" },
278#if defined(SYS_getdents64)
279 { 221, "getdents64", getdents64Func },
280#else
281 { 221, "getdents64" },
282#endif
283 { 222, "fcntl64" },
284 { 223, "unused" },
285 { 224, "gettid", gettidFunc },
286 { 225, "readahead" },
287 { 226, "setxattr" },
288 { 227, "lsetxattr" },
289 { 228, "fsetxattr" },
290 { 229, "getxattr" },
291 { 230, "lgetxattr" },
292 { 231, "fgetxattr" },
293 { 232, "listxattr" },
294 { 233, "llistxattr" },
295 { 234, "flistxattr" },
296 { 235, "removexattr" },
297 { 236, "lremovexattr" },
298 { 237, "fremovexattr" },
299 { 238, "tkill" },
300 { 239, "sendfile64" },
301 { 240, "futex" },
302 { 241, "sched_setaffinity", ignoreFunc },
303 { 242, "sched_getaffinity", ignoreFunc },
304 { 243, "set_thread_area", setThreadArea32Func },
305 { 244, "get_thread_area" },
306 { 245, "io_setup" },
307 { 246, "io_destroy" },
308 { 247, "io_getevents" },
309 { 248, "io_submit" },
310 { 249, "io_cancel" },
311 { 250, "fadvise64" },
312 { 251, "unused" },
313 { 252, "exit_group", exitFunc },
314 { 253, "lookup_dcookie" },
315 { 254, "epoll_create" },
316 { 255, "epoll_ctl" },
317 { 256, "epoll_wait" },
318 { 257, "remap_file_pages" },
319 { 258, "set_tid_address", setTidAddressFunc },
320 { 259, "timer_create" },
321 { 260, "timer_settime" },
322 { 261, "timer_gettime" },
323 { 262, "timer_getoverrun" },
324 { 263, "timer_delete" },
325 { 264, "clock_settime" },
326 { 265, "clock_gettime", clock_gettimeFunc<X86Linux32> },
327 { 266, "clock_getres" },
328 { 267, "clock_nanosleep" },
329 { 268, "statfs64" },
330 { 269, "fstatfs64" },
331 { 270, "tgkill", tgkillFunc<X86Linux32> },
332 { 271, "utimes" },
333 { 272, "fadvise64_64" },
334 { 273, "vserver" },
335 { 274, "mbind" },
336 { 275, "get_mempolicy", ignoreFunc },
337 { 276, "set_mempolicy" },
338 { 277, "mq_open" },
339 { 278, "mq_unlink" },
340 { 279, "mq_timedsend" },
341 { 280, "mq_timedreceive" },
342 { 281, "mq_notify" },
343 { 282, "mq_getsetattr" },
344 { 283, "kexec_load" },
345 { 284, "waitid" },
346 { 285, "sys_setaltroot" },
347 { 286, "add_key" },
348 { 287, "request_key" },
349 { 288, "keyctl" },
350 { 289, "ioprio_set" },
351 { 290, "ioprio_get" },
352 { 291, "inotify_init" },
353 { 292, "inotify_add_watch" },
354 { 293, "inotify_rm_watch" },
355 { 294, "migrate_pages" },
356 { 295, "openat", openatFunc<X86Linux32> },
357 { 296, "mkdirat" },
358 { 297, "mknodat" },
359 { 298, "fchownat" },
360 { 299, "futimesat" },
361 { 300, "fstatat64" },
362 { 301, "unlinkat" },
363 { 302, "renameat" },
364 { 303, "linkat" },
365 { 304, "symlinkat" },
366 { 305, "readlinkat", readlinkFunc<X86Linux32> },
367 { 306, "fchmodat" },
368 { 307, "faccessat" },
369 { 308, "pselect6" },
370 { 309, "ppoll" },
371 { 310, "unshare" },
372 { 311, "set_robust_list", ignoreFunc },
373 { 312, "get_robust_list", ignoreFunc },
374 { 313, "splice" },
375 { 314, "sync_file_range" },
376 { 315, "tee" },
377 { 316, "vmsplice" },
378 { 317, "move_pages" },
379 { 318, "getcpu", getcpuFunc },
380 { 319, "epoll_pwait" },
381 { 320, "utimensat" },
382 { 321, "signalfd" },
383 { 322, "timerfd" },
384 { 323, "eventfd", eventfdFunc<X86Linux32> },
385 { 355, "getrandom", getrandomFunc<X86Linux32>}
386};
387
388} // namespace X86ISA
389} // namespace gem5
static SyscallDescTable< SyscallABI32 > syscallDescs32
SyscallReturn unameFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< Linux::utsname > name)
Target uname() handler.
Definition syscalls.cc:49
SyscallReturn setThreadArea32Func(SyscallDesc *desc, ThreadContext *tc, VPtr< UserDesc32 > userDesc)
Definition syscalls.cc:100
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
SyscallReturn gettidFunc(SyscallDesc *desc, ThreadContext *tc)
Target gettid() handler.
SyscallReturn brkFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> new_brk)
Target brk() handler: set brk address.
SyscallReturn getpidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getpid() handler.
SyscallReturn chdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname)
Target chdir() handler.
SyscallReturn truncate64Func(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, int64_t length)
Target truncate64() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, ThreadContext *tc)
SyscallReturn _llseekFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, uint32_t offset_high, uint32_t offset_low, VPtr<> result_ptr, int whence)
Target _llseek() handler.
SyscallReturn mknodFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode, dev_t dev)
Target mknod() handler.
SyscallReturn setpgidFunc(SyscallDesc *desc, ThreadContext *tc, int pid, int pgid)
Target setpgid() handler.
SyscallReturn geteuidFunc(SyscallDesc *desc, ThreadContext *tc)
Target geteuid() handler.
SyscallReturn pipeFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tgt_addr)
Target pipe() handler.
SyscallReturn mkdirFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn dupFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
SyscallReturn ftruncate64Func(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int64_t length)
Target ftruncate64() handler.
SyscallReturn setTidAddressFunc(SyscallDesc *desc, ThreadContext *tc, VPtr<> tidPtr)
Target set_tid_address() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd, int cmd, guest_abi::VarArgs< int > varargs)
Target fcntl() handler.
SyscallReturn getegidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getegid() handler.
SyscallReturn getcpuFunc(SyscallDesc *desc, ThreadContext *tc, VPtr< uint32_t > cpu, VPtr< uint32_t > node, VPtr< uint32_t > tcache)
SyscallReturn ignoreFunc(SyscallDesc *desc, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling,...
SyscallReturn exitFunc(SyscallDesc *desc, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
SyscallReturn dup2Func(SyscallDesc *desc, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
Target dup2() handler.
SyscallReturn getgidFunc(SyscallDesc *desc, ThreadContext *tc)
Target getgid() handler.
SyscallReturn closeFunc(SyscallDesc *desc, ThreadContext *tc, int tgt_fd)
Target close() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, ThreadContext *tc)
Target umask() handler.
This file defines objects used to emulate syscalls from the target application on the host machine.

Generated on Mon Jan 13 2025 04:28:28 for gem5 by doxygen 1.9.8