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

Generated on Sat Jun 18 2022 08:12:17 for gem5 by doxygen 1.8.17