gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
process.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * Copyright (c) 2007-2008 The Florida State University
4  * Copyright (c) 2009 The University of Edinburgh
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are
9  * met: redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer;
11  * redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution;
14  * neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  * Authors: Korey Sewell
31  * Stephen Hines
32  * Timothy M. Jones
33  */
34 
36 
37 #include "arch/power/isa_traits.hh"
39 #include "base/trace.hh"
40 #include "cpu/thread_context.hh"
41 #include "kern/linux/linux.hh"
42 #include "sim/process.hh"
43 #include "sim/syscall_desc.hh"
44 #include "sim/syscall_emul.hh"
45 #include "sim/system.hh"
46 
47 using namespace std;
48 using namespace PowerISA;
49 
51 static SyscallReturn
52 unameFunc(SyscallDesc *desc, int callnum, Process *process,
53  ThreadContext *tc)
54 {
55  int index = 0;
57 
58  strcpy(name->sysname, "Linux");
59  strcpy(name->nodename, "sim.gem5.org");
60  strcpy(name->release, "3.0.0");
61  strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
62  strcpy(name->machine, "power");
63 
64  name.copyOut(tc->getMemProxy());
65  return 0;
66 }
67 
69  /* 0 */ SyscallDesc("syscall", unimplementedFunc),
70  /* 1 */ SyscallDesc("exit", exitFunc),
71  /* 2 */ SyscallDesc("fork", unimplementedFunc),
72  /* 3 */ SyscallDesc("read", readFunc),
73  /* 4 */ SyscallDesc("write", writeFunc),
74  /* 5 */ SyscallDesc("open", openFunc<PowerLinux>),
75  /* 6 */ SyscallDesc("close", closeFunc),
76  /* 7 */ SyscallDesc("waitpid", unimplementedFunc), //???
77  /* 8 */ SyscallDesc("creat", unimplementedFunc),
78  /* 9 */ SyscallDesc("link", unimplementedFunc),
79  /* 10 */ SyscallDesc("unlink", unlinkFunc),
80  /* 11 */ SyscallDesc("execve", unimplementedFunc),
81  /* 12 */ SyscallDesc("chdir", unimplementedFunc),
82  /* 13 */ SyscallDesc("time", timeFunc<PowerLinux>),
83  /* 14 */ SyscallDesc("mknod", unimplementedFunc),
84  /* 15 */ SyscallDesc("chmod", chmodFunc<PowerLinux>),
85  /* 16 */ SyscallDesc("lchown", chownFunc),
86  /* 17 */ SyscallDesc("break", brkFunc), //???
87  /* 18 */ SyscallDesc("unused#18", unimplementedFunc), //???
88  /* 19 */ SyscallDesc("lseek", lseekFunc),
89  /* 20 */ SyscallDesc("getpid", getpidFunc),
90  /* 21 */ SyscallDesc("mount", unimplementedFunc),
91  /* 22 */ SyscallDesc("umount", unimplementedFunc),
92  /* 23 */ SyscallDesc("setuid", setuidFunc),
93  /* 24 */ SyscallDesc("getuid", getuidFunc),
94  /* 25 */ SyscallDesc("stime", unimplementedFunc),
95  /* 26 */ SyscallDesc("ptrace", unimplementedFunc),
96  /* 27 */ SyscallDesc("alarm", unimplementedFunc),
97  /* 28 */ SyscallDesc("unused#28", unimplementedFunc),
98  /* 29 */ SyscallDesc("pause", unimplementedFunc),
99  /* 30 */ SyscallDesc("utime", unimplementedFunc),
100  /* 31 */ SyscallDesc("stty", unimplementedFunc),
101  /* 32 */ SyscallDesc("gtty", unimplementedFunc),
102  /* 33 */ SyscallDesc("access", unimplementedFunc),
103  /* 34 */ SyscallDesc("nice", unimplementedFunc),
104  /* 35 */ SyscallDesc("ftime", unimplementedFunc),
105  /* 36 */ SyscallDesc("sync", unimplementedFunc),
106  /* 37 */ SyscallDesc("kill", ignoreFunc),
107  /* 38 */ SyscallDesc("rename", renameFunc),
108  /* 39 */ SyscallDesc("mkdir", unimplementedFunc),
109  /* 40 */ SyscallDesc("rmdir", unimplementedFunc),
110  /* 41 */ SyscallDesc("dup", dupFunc),
111  /* 42 */ SyscallDesc("pipe", unimplementedFunc),
112  /* 43 */ SyscallDesc("times", timesFunc<PowerLinux>),
113  /* 44 */ SyscallDesc("prof", unimplementedFunc),
114  /* 45 */ SyscallDesc("brk", brkFunc),
115  /* 46 */ SyscallDesc("setgid", unimplementedFunc),
116  /* 47 */ SyscallDesc("getgid", getgidFunc),
117  /* 48 */ SyscallDesc("signal", ignoreFunc),
118  /* 49 */ SyscallDesc("geteuid", geteuidFunc),
119  /* 50 */ SyscallDesc("getegid", getegidFunc),
120  /* 51 */ SyscallDesc("acct", unimplementedFunc),
121  /* 52 */ SyscallDesc("umount2", unimplementedFunc),
122  /* 53 */ SyscallDesc("lock", unimplementedFunc),
123  /* 54 */ SyscallDesc("ioctl", ioctlFunc<PowerLinux>),
124  /* 55 */ SyscallDesc("fcntl", fcntlFunc),
125  /* 56 */ SyscallDesc("mpx", unimplementedFunc),
126  /* 57 */ SyscallDesc("setpgid", unimplementedFunc),
127  /* 58 */ SyscallDesc("ulimit", unimplementedFunc),
128  /* 59 */ SyscallDesc("unused#59", unimplementedFunc),
129  /* 60 */ SyscallDesc("umask", umaskFunc),
130  /* 61 */ SyscallDesc("chroot", unimplementedFunc),
131  /* 62 */ SyscallDesc("ustat", unimplementedFunc),
132  /* 63 */ SyscallDesc("dup2", unimplementedFunc),
133  /* 64 */ SyscallDesc("getppid", getpagesizeFunc),
134  /* 65 */ SyscallDesc("getpgrp", unimplementedFunc),
135  /* 66 */ SyscallDesc("setsid", unimplementedFunc),
136  /* 67 */ SyscallDesc("sigaction",unimplementedFunc),
137  /* 68 */ SyscallDesc("sgetmask", unimplementedFunc),
138  /* 69 */ SyscallDesc("ssetmask", unimplementedFunc),
139  /* 70 */ SyscallDesc("setreuid", unimplementedFunc),
140  /* 71 */ SyscallDesc("setregid", unimplementedFunc),
141  /* 72 */ SyscallDesc("sigsuspend", unimplementedFunc),
142  /* 73 */ SyscallDesc("sigpending", unimplementedFunc),
143  /* 74 */ SyscallDesc("sethostname", ignoreFunc),
144  /* 75 */ SyscallDesc("setrlimit", ignoreFunc),
145  /* 76 */ SyscallDesc("getrlimit", unimplementedFunc),
146  /* 77 */ SyscallDesc("getrusage", ignoreFunc),
147  /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc),
148  /* 79 */ SyscallDesc("settimeofday", unimplementedFunc),
149  /* 80 */ SyscallDesc("getgroups", unimplementedFunc),
150  /* 81 */ SyscallDesc("setgroups", unimplementedFunc),
151  /* 82 */ SyscallDesc("reserved#82", unimplementedFunc),
152  /* 83 */ SyscallDesc("symlink", unimplementedFunc),
153  /* 84 */ SyscallDesc("unused#84", unimplementedFunc),
154  /* 85 */ SyscallDesc("readlink", unimplementedFunc),
155  /* 86 */ SyscallDesc("uselib", unimplementedFunc),
156  /* 87 */ SyscallDesc("swapon", gethostnameFunc),
157  /* 88 */ SyscallDesc("reboot", unimplementedFunc),
158  /* 89 */ SyscallDesc("readdir", unimplementedFunc),
159  /* 90 */ SyscallDesc("mmap", mmapFunc<PowerLinux>),
160  /* 91 */ SyscallDesc("munmap",munmapFunc),
161  /* 92 */ SyscallDesc("truncate", truncateFunc),
162  /* 93 */ SyscallDesc("ftruncate", ftruncateFunc),
163  /* 94 */ SyscallDesc("fchmod", unimplementedFunc),
164  /* 95 */ SyscallDesc("fchown", unimplementedFunc),
165  /* 96 */ SyscallDesc("getpriority", unimplementedFunc),
166  /* 97 */ SyscallDesc("setpriority", unimplementedFunc),
167  /* 98 */ SyscallDesc("profil", unimplementedFunc),
168  /* 99 */ SyscallDesc("statfs", unimplementedFunc),
169  /* 100 */ SyscallDesc("fstatfs", unimplementedFunc),
170  /* 101 */ SyscallDesc("ioperm", unimplementedFunc),
171  /* 102 */ SyscallDesc("socketcall", unimplementedFunc),
172  /* 103 */ SyscallDesc("syslog", unimplementedFunc),
173  /* 104 */ SyscallDesc("setitimer", unimplementedFunc),
174  /* 105 */ SyscallDesc("getitimer", unimplementedFunc),
175  /* 106 */ SyscallDesc("stat", statFunc<PowerLinux>),
176  /* 107 */ SyscallDesc("lstat", unimplementedFunc),
177  /* 108 */ SyscallDesc("fstat", fstatFunc<PowerLinux>),
178  /* 109 */ SyscallDesc("unused#109", unimplementedFunc),
179  /* 110 */ SyscallDesc("iopl", unimplementedFunc),
180  /* 111 */ SyscallDesc("vhangup", unimplementedFunc),
181  /* 112 */ SyscallDesc("idle", ignoreFunc),
182  /* 113 */ SyscallDesc("vm86", unimplementedFunc),
183  /* 114 */ SyscallDesc("wait4", unimplementedFunc),
184  /* 115 */ SyscallDesc("swapoff", unimplementedFunc),
185  /* 116 */ SyscallDesc("sysinfo", unimplementedFunc),
186  /* 117 */ SyscallDesc("ipc", unimplementedFunc),
187  /* 118 */ SyscallDesc("fsync", unimplementedFunc),
188  /* 119 */ SyscallDesc("sigreturn", unimplementedFunc),
189  /* 120 */ SyscallDesc("clone", unimplementedFunc),
190  /* 121 */ SyscallDesc("setdomainname", unimplementedFunc),
191  /* 122 */ SyscallDesc("uname", unameFunc),
192  /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc),
193  /* 124 */ SyscallDesc("adjtimex", unimplementedFunc),
194  /* 125 */ SyscallDesc("mprotect", ignoreFunc),
195  /* 126 */ SyscallDesc("sigprocmask", unimplementedFunc),
196  /* 127 */ SyscallDesc("create_module", unimplementedFunc),
197  /* 128 */ SyscallDesc("init_module", unimplementedFunc),
198  /* 129 */ SyscallDesc("delete_module", unimplementedFunc),
199  /* 130 */ SyscallDesc("get_kernel_syms", unimplementedFunc),
200  /* 131 */ SyscallDesc("quotactl", unimplementedFunc),
201  /* 132 */ SyscallDesc("getpgid", unimplementedFunc),
202  /* 133 */ SyscallDesc("fchdir", unimplementedFunc),
203  /* 134 */ SyscallDesc("bdflush", unimplementedFunc),
204  /* 135 */ SyscallDesc("sysfs", unimplementedFunc),
205  /* 136 */ SyscallDesc("personality", unimplementedFunc),
206  /* 137 */ SyscallDesc("afs_syscall", unimplementedFunc),
207  /* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
208  /* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
209  /* 140 */ SyscallDesc("llseek", _llseekFunc),
210  /* 141 */ SyscallDesc("getdents", unimplementedFunc),
211  /* 142 */ SyscallDesc("newselect", unimplementedFunc),
212  /* 143 */ SyscallDesc("flock", unimplementedFunc),
213  /* 144 */ SyscallDesc("msync", unimplementedFunc),
214  /* 145 */ SyscallDesc("readv", unimplementedFunc),
215  /* 146 */ SyscallDesc("writev", writevFunc<PowerLinux>),
216  /* 147 */ SyscallDesc("getsid", unimplementedFunc),
217  /* 148 */ SyscallDesc("fdatasync", unimplementedFunc),
218  /* 149 */ SyscallDesc("sysctl", unimplementedFunc),
219  /* 150 */ SyscallDesc("mlock", unimplementedFunc),
220  /* 151 */ SyscallDesc("munlock", unimplementedFunc),
221  /* 152 */ SyscallDesc("mlockall", unimplementedFunc),
222  /* 153 */ SyscallDesc("munlockall", unimplementedFunc),
223  /* 154 */ SyscallDesc("sched_setparam", unimplementedFunc),
224  /* 155 */ SyscallDesc("sched_getparam", unimplementedFunc),
225  /* 156 */ SyscallDesc("sched_setscheduler", unimplementedFunc),
226  /* 157 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
227  /* 158 */ SyscallDesc("sched_yield", unimplementedFunc),
228  /* 159 */ SyscallDesc("sched_get_priority_max", unimplementedFunc),
229  /* 160 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
230  /* 161 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
231  /* 162 */ SyscallDesc("nanosleep", unimplementedFunc),
232  /* 163 */ SyscallDesc("mremap", unimplementedFunc),
233  /* 164 */ SyscallDesc("setresuid", unimplementedFunc),
234  /* 165 */ SyscallDesc("getresuid", unimplementedFunc),
235  /* 166 */ SyscallDesc("vm862", unimplementedFunc),
236  /* 167 */ SyscallDesc("query_module", unimplementedFunc),
237  /* 168 */ SyscallDesc("poll", unimplementedFunc),
238  /* 169 */ SyscallDesc("nfsservctl", unimplementedFunc),
239  /* 170 */ SyscallDesc("setresgid", unimplementedFunc),
240  /* 171 */ SyscallDesc("getresgid", unimplementedFunc),
241  /* 172 */ SyscallDesc("prctl", unimplementedFunc),
242  /* 173 */ SyscallDesc("rt_sigaction", ignoreFunc),
243  /* 174 */ SyscallDesc("rt_sigprocmask", unimplementedFunc),
244  /* 175 */ SyscallDesc("unknown#175", unimplementedFunc),
245  /* 176 */ SyscallDesc("rt_sigpending", unimplementedFunc),
246  /* 177 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
247  /* 178 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc),
248  /* 179 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
249  /* 180 */ SyscallDesc("pread64", unimplementedFunc),
250  /* 181 */ SyscallDesc("pwrite64", unimplementedFunc),
251  /* 182 */ SyscallDesc("chown", unimplementedFunc),
252  /* 183 */ SyscallDesc("getcwd", unimplementedFunc),
253  /* 184 */ SyscallDesc("capget", unimplementedFunc),
254  /* 185 */ SyscallDesc("capset", unimplementedFunc),
255  /* 186 */ SyscallDesc("sigaltstack", unimplementedFunc),
256  /* 187 */ SyscallDesc("sendfile", unimplementedFunc),
257  /* 188 */ SyscallDesc("getpmsg", unimplementedFunc),
258  /* 189 */ SyscallDesc("putpmsg", unimplementedFunc),
259  /* 190 */ SyscallDesc("ugetrlimit", ignoreFunc),
260  /* 191 */ SyscallDesc("getrlimit", unimplementedFunc),
261  /* 192 */ SyscallDesc("mmap2", mmapFunc<PowerLinux>),
262  /* 193 */ SyscallDesc("truncate64", unimplementedFunc),
263  /* 194 */ SyscallDesc("ftruncate64", ftruncate64Func),
264  /* 195 */ SyscallDesc("stat64", stat64Func<PowerLinux>),
265  /* 196 */ SyscallDesc("lstat64", lstat64Func<PowerLinux>),
266  /* 197 */ SyscallDesc("fstat64", fstat64Func<PowerLinux>),
267  /* 198 */ SyscallDesc("lchown", unimplementedFunc),
268  /* 199 */ SyscallDesc("getuid", getuidFunc),
269  /* 200 */ SyscallDesc("getgid", getgidFunc),
270  /* 201 */ SyscallDesc("geteuid", geteuidFunc),
271  /* 202 */ SyscallDesc("getegid", getegidFunc),
272  /* 203 */ SyscallDesc("setreuid", unimplementedFunc),
273  /* 204 */ SyscallDesc("fcntl64", fcntl64Func),
274  /* 205 */ SyscallDesc("getgroups", unimplementedFunc),
275  /* 206 */ SyscallDesc("setgroups", unimplementedFunc),
276  /* 207 */ SyscallDesc("fchown", unimplementedFunc),
277  /* 208 */ SyscallDesc("setresuid", unimplementedFunc),
278  /* 209 */ SyscallDesc("getresuid", unimplementedFunc),
279  /* 210 */ SyscallDesc("setresgid", unimplementedFunc),
280  /* 211 */ SyscallDesc("getresgid", unimplementedFunc),
281  /* 212 */ SyscallDesc("chown", unimplementedFunc),
282  /* 213 */ SyscallDesc("setuid", unimplementedFunc),
283  /* 214 */ SyscallDesc("setgid", unimplementedFunc),
284  /* 215 */ SyscallDesc("setfsuid", unimplementedFunc),
285  /* 216 */ SyscallDesc("setfsgid", unimplementedFunc),
286  /* 217 */ SyscallDesc("getdents64", unimplementedFunc),
287  /* 218 */ SyscallDesc("pivot_root", unimplementedFunc),
288  /* 219 */ SyscallDesc("mincore", unimplementedFunc),
289  /* 220 */ SyscallDesc("madvise", unimplementedFunc),
290  /* 221 */ SyscallDesc("unknown#221", unimplementedFunc),
291  /* 222 */ SyscallDesc("tux", unimplementedFunc),
292  /* 223 */ SyscallDesc("unknown#223", unimplementedFunc),
293  /* 224 */ SyscallDesc("gettid", unimplementedFunc),
294  /* 225 */ SyscallDesc("readahead", unimplementedFunc),
295  /* 226 */ SyscallDesc("setxattr", unimplementedFunc),
296  /* 227 */ SyscallDesc("lsetxattr", unimplementedFunc),
297  /* 228 */ SyscallDesc("fsetxattr", unimplementedFunc),
298  /* 229 */ SyscallDesc("getxattr", unimplementedFunc),
299  /* 230 */ SyscallDesc("lgetxattr", unimplementedFunc),
300  /* 231 */ SyscallDesc("fgetxattr", unimplementedFunc),
301  /* 232 */ SyscallDesc("listxattr", unimplementedFunc),
302  /* 233 */ SyscallDesc("llistxattr", unimplementedFunc),
303  /* 234 */ SyscallDesc("exit_group", exitGroupFunc),
304  /* 235 */ SyscallDesc("removexattr", unimplementedFunc),
305  /* 236 */ SyscallDesc("lremovexattr", unimplementedFunc),
306  /* 237 */ SyscallDesc("fremovexattr", unimplementedFunc),
307  /* 238 */ SyscallDesc("tkill", unimplementedFunc),
308  /* 239 */ SyscallDesc("sendfile64", unimplementedFunc),
309  /* 240 */ SyscallDesc("futex", unimplementedFunc),
310  /* 241 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
311  /* 242 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
312  /* 243 */ SyscallDesc("io_setup", unimplementedFunc),
313  /* 244 */ SyscallDesc("io_destory", unimplementedFunc),
314  /* 245 */ SyscallDesc("io_getevents", unimplementedFunc),
315  /* 246 */ SyscallDesc("io_submit", unimplementedFunc),
316  /* 247 */ SyscallDesc("io_cancel", unimplementedFunc),
317  /* 248 */ SyscallDesc("unknown#248", unimplementedFunc),
318  /* 249 */ SyscallDesc("lookup_dcookie", unimplementedFunc),
319  /* 250 */ SyscallDesc("epoll_create", unimplementedFunc),
320  /* 251 */ SyscallDesc("epoll_ctl", unimplementedFunc),
321  /* 252 */ SyscallDesc("epoll_wait", unimplementedFunc),
322  /* 253 */ SyscallDesc("remap_file_pages", unimplementedFunc),
323  /* 254 */ SyscallDesc("set_thread_area", unimplementedFunc),
324  /* 255 */ SyscallDesc("get_thread_area", unimplementedFunc),
325  /* 256 */ SyscallDesc("set_tid_address", unimplementedFunc),
326  /* 257 */ SyscallDesc("timer_create", unimplementedFunc),
327  /* 258 */ SyscallDesc("timer_settime", unimplementedFunc),
328  /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc),
329  /* 260 */ SyscallDesc("timer_getoverrun", unimplementedFunc),
330  /* 261 */ SyscallDesc("timer_delete", unimplementedFunc),
331  /* 262 */ SyscallDesc("clock_settime", unimplementedFunc),
332  /* 263 */ SyscallDesc("clock_gettime", unimplementedFunc),
333  /* 264 */ SyscallDesc("clock_getres", unimplementedFunc),
334  /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
335  /* 266 */ SyscallDesc("statfs64", unimplementedFunc),
336  /* 267 */ SyscallDesc("fstatfs64", unimplementedFunc),
337  /* 268 */ SyscallDesc("tgkill", unimplementedFunc),
338  /* 269 */ SyscallDesc("utimes", unimplementedFunc),
339  /* 270 */ SyscallDesc("arm_fadvise64_64", unimplementedFunc),
340  /* 271 */ SyscallDesc("pciconfig_iobase", unimplementedFunc),
341  /* 272 */ SyscallDesc("pciconfig_read", unimplementedFunc),
342  /* 273 */ SyscallDesc("pciconfig_write", unimplementedFunc),
343  /* 274 */ SyscallDesc("mq_open", unimplementedFunc),
344  /* 275 */ SyscallDesc("mq_unlink", unimplementedFunc),
345  /* 276 */ SyscallDesc("mq_timedsend", unimplementedFunc),
346  /* 277 */ SyscallDesc("mq_timedreceive", unimplementedFunc),
347  /* 278 */ SyscallDesc("mq_notify", unimplementedFunc),
348  /* 279 */ SyscallDesc("mq_getsetattr", unimplementedFunc),
349  /* 280 */ SyscallDesc("waitid", unimplementedFunc),
350  /* 281 */ SyscallDesc("socket", unimplementedFunc),
351  /* 282 */ SyscallDesc("bind", unimplementedFunc),
352  /* 283 */ SyscallDesc("connect", unimplementedFunc),
353  /* 284 */ SyscallDesc("listen", unimplementedFunc),
354  /* 285 */ SyscallDesc("accept", unimplementedFunc),
355  /* 286 */ SyscallDesc("getsockname", unimplementedFunc),
356  /* 287 */ SyscallDesc("getpeername", unimplementedFunc),
357  /* 288 */ SyscallDesc("socketpair", unimplementedFunc),
358  /* 289 */ SyscallDesc("send", unimplementedFunc),
359  /* 290 */ SyscallDesc("sendto", unimplementedFunc),
360  /* 291 */ SyscallDesc("recv", unimplementedFunc),
361  /* 292 */ SyscallDesc("recvfrom", unimplementedFunc),
362  /* 293 */ SyscallDesc("shutdown", unimplementedFunc),
363  /* 294 */ SyscallDesc("setsockopt", unimplementedFunc),
364  /* 295 */ SyscallDesc("getsockopt", unimplementedFunc),
365  /* 296 */ SyscallDesc("sendmsg", unimplementedFunc),
366  /* 297 */ SyscallDesc("rcvmsg", unimplementedFunc),
367  /* 298 */ SyscallDesc("semop", unimplementedFunc),
368  /* 299 */ SyscallDesc("semget", unimplementedFunc),
369  /* 300 */ SyscallDesc("semctl", unimplementedFunc),
370  /* 301 */ SyscallDesc("msgsend", unimplementedFunc),
371  /* 302 */ SyscallDesc("msgrcv", unimplementedFunc),
372  /* 303 */ SyscallDesc("msgget", unimplementedFunc),
373  /* 304 */ SyscallDesc("msgctl", unimplementedFunc),
374  /* 305 */ SyscallDesc("shmat", unimplementedFunc),
375  /* 306 */ SyscallDesc("shmdt", unimplementedFunc),
376  /* 307 */ SyscallDesc("shmget", unimplementedFunc),
377  /* 308 */ SyscallDesc("shmctl", unimplementedFunc),
378  /* 309 */ SyscallDesc("add_key", unimplementedFunc),
379  /* 310 */ SyscallDesc("request_key", unimplementedFunc),
380  /* 311 */ SyscallDesc("keyctl", unimplementedFunc),
381  /* 312 */ SyscallDesc("semtimedop", unimplementedFunc),
382  /* 313 */ SyscallDesc("vserver", unimplementedFunc),
383  /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc),
384  /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc),
385  /* 316 */ SyscallDesc("inotify_init", unimplementedFunc),
386  /* 317 */ SyscallDesc("inotify_add_watch", unimplementedFunc),
387  /* 318 */ SyscallDesc("inotify_rm_watch", unimplementedFunc),
388  /* 319 */ SyscallDesc("mbind", unimplementedFunc),
389  /* 320 */ SyscallDesc("get_mempolicy", unimplementedFunc),
390  /* 321 */ SyscallDesc("set_mempolicy", unimplementedFunc),
391  /* 322 */ SyscallDesc("openat", unimplementedFunc),
392  /* 323 */ SyscallDesc("mkdirat", unimplementedFunc),
393  /* 324 */ SyscallDesc("mknodat", unimplementedFunc),
394  /* 325 */ SyscallDesc("fchownat", unimplementedFunc),
395  /* 326 */ SyscallDesc("futimesat", unimplementedFunc),
396  /* 327 */ SyscallDesc("fstatat64", unimplementedFunc),
397  /* 328 */ SyscallDesc("unlinkat", unimplementedFunc),
398  /* 329 */ SyscallDesc("renameat", unimplementedFunc),
399  /* 330 */ SyscallDesc("linkat", unimplementedFunc),
400  /* 331 */ SyscallDesc("symlinkat", unimplementedFunc),
401  /* 332 */ SyscallDesc("readlinkat", unimplementedFunc),
402  /* 333 */ SyscallDesc("fchmodat", unimplementedFunc),
403  /* 334 */ SyscallDesc("faccessat", unimplementedFunc),
404  /* 335 */ SyscallDesc("pselect6", unimplementedFunc),
405  /* 336 */ SyscallDesc("ppoll", unimplementedFunc),
406  /* 337 */ SyscallDesc("unshare", unimplementedFunc),
407  /* 338 */ SyscallDesc("set_robust_list", unimplementedFunc),
408  /* 339 */ SyscallDesc("get_robust_list", unimplementedFunc),
409  /* 340 */ SyscallDesc("splice", unimplementedFunc),
410  /* 341 */ SyscallDesc("arm_sync_file_range", unimplementedFunc),
411  /* 342 */ SyscallDesc("tee", unimplementedFunc),
412  /* 343 */ SyscallDesc("vmsplice", unimplementedFunc),
413  /* 344 */ SyscallDesc("move_pages", unimplementedFunc),
414  /* 345 */ SyscallDesc("getcpu", unimplementedFunc),
415  /* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc),
416 };
417 
419  ObjectFile *objFile)
420  : PowerProcess(params, objFile),
421  Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
422 {
423 }
424 
427 {
428  if (callnum < 0 || callnum > Num_Syscall_Descs)
429  return NULL;
430 
431  return &syscallDescs[callnum];
432 }
433 
434 void
436 {
438 }
439 
442 {
443  // Linux apparently allows more parameter than the ABI says it should.
444  // This limit may need to be increased even further.
445  assert(i < 6);
446  return tc->readIntReg(ArgumentReg0 + i++);
447 }
448 
449 void
451 {
452  // Linux apparently allows more parameter than the ABI says it should.
453  // This limit may need to be increased even further.
454  assert(i < 6);
455  tc->setIntReg(ArgumentReg0 + i, val);
456 }
virtual SyscallDesc * getDesc(int callnum)
Definition: process.cc:426
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target ftruncate() handler.
Bitfield< 30, 0 > index
SyscallReturn brkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target brk() handler: set brk address.
const std::string & name()
Definition: trace.cc:49
Bitfield< 7 > i
Definition: miscregs.hh:1378
SyscallReturn dupFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
FIXME: The file description is not shared among file descriptors created with dup.
const int ArgumentReg0
Definition: registers.hh:97
SyscallReturn ignoreFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Handler for unimplemented syscalls that we never intend to implement (signal handling, etc.) and should not affect the correct behavior of the program.
Definition: syscall_emul.cc:67
SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target getpagesize() handler.
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i)=0
static SyscallDesc syscallDescs[]
Array of syscall descriptors, indexed by call number.
Definition: process.hh:54
virtual void setIntReg(int reg_idx, uint64_t val)=0
PowerISA::IntReg getSyscallArg(ThreadContext *tc, int &i)
Definition: process.cc:441
SyscallReturn getpidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target getpid() handler.
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
ThreadContext is the external interface to all thread state for anything outside of the CPU...
SyscallReturn getegidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target getegid() handler.
Bitfield< 63 > val
Definition: misc.hh:770
SyscallReturn _llseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target _llseek() handler.
SyscallReturn fcntlFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target fcntl() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target munmap() handler.
SyscallReturn writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target write() handler.
SyscallReturn unimplementedFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Handler for unimplemented syscalls that we haven't thought about.
Definition: syscall_emul.cc:57
virtual uint64_t readIntReg(int reg_idx)=0
SyscallReturn exitGroupFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
Target exit_group() handler: terminate simulation. (exit all threads)
SyscallReturn lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target lseek() handler.
void setSyscallArg(ThreadContext *tc, int i, PowerISA::IntReg val)
Definition: process.cc:450
uint64_t IntReg
Definition: registers.hh:48
void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:74
SyscallReturn unlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
SyscallReturn geteuidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target geteuid() handler.
virtual SETranslatingPortProxy & getMemProxy()=0
PowerLinuxProcess(ProcessParams *params, ObjectFile *objFile)
Definition: process.cc:418
SyscallReturn setuidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target setuid() handler.
This class provides the wrapper interface for the system call implementations which are defined in th...
Definition: syscall_desc.hh:63
SyscallReturn truncateFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target truncate() handler.
SyscallReturn getgidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target getgid() handler.
SyscallReturn renameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target rename() handler.
SyscallReturn fcntl64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target fcntl64() handler.
This file defines objects used to emulate syscalls from the target application on the host machine...
SyscallReturn getuidFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target getuid() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, int num, Process *process, ThreadContext *tc)
Target umask() handler.
SyscallReturn chownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target chown() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target gethostname() handler.
SyscallReturn exitFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
Target exit() handler: terminate current context.
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target ftruncate64() handler.
SyscallReturn closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target close() handler.
static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target uname() handler.
Definition: process.cc:52
This class represents the return value from an emulated system call, including any errno setting...
const int Num_Syscall_Descs
Definition: process.hh:56
SyscallReturn readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
void initState()
initState() is called on each SimObject when not restoring from a checkpoint.
Definition: process.cc:435

Generated on Fri Jun 9 2017 13:03:35 for gem5 by doxygen 1.8.6