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) 2005 The Regents of The University of Michigan
3  * Copyright (c) 2007 MIPS Technologies, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  *
29  * Authors: Gabe Black
30  * Korey Sewell
31  */
32 
34 
35 #include "arch/mips/isa_traits.hh"
36 #include "arch/mips/linux/linux.hh"
37 #include "base/trace.hh"
38 #include "cpu/thread_context.hh"
39 #include "debug/SyscallVerbose.hh"
40 #include "kern/linux/linux.hh"
41 #include "sim/eventq.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 MipsISA;
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, "mips");
63 
64  name.copyOut(tc->getMemProxy());
65  return 0;
66 }
67 
71 static SyscallReturn
72 sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
73  ThreadContext *tc)
74 {
75  int index = 0;
76  unsigned op = process->getSyscallArg(tc, index);
77  unsigned bufPtr = process->getSyscallArg(tc, index);
78  // unsigned nbytes = process->getSyscallArg(tc, index);
79 
80  switch (op) {
81  case 45:
82  {
83  // GSI_IEEE_FP_CONTROL
84  TypedBufferArg<uint64_t> fpcr(bufPtr);
85  // I don't think this exactly matches the HW FPCR
86  *fpcr = 0;
87  fpcr.copyOut(tc->getMemProxy());
88  return 0;
89  }
90  default:
91  cerr << "sys_getsysinfo: unknown op " << op << endl;
92  abort();
93  break;
94  }
95 
96  return 1;
97 }
98 
100 static SyscallReturn
101 sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process,
102  ThreadContext *tc)
103 {
104  int index = 0;
105  unsigned op = process->getSyscallArg(tc, index);
106  Addr bufPtr = process->getSyscallArg(tc, index);
107  // unsigned nbytes = process->getSyscallArg(tc, index);
108 
109  switch (op) {
110 
111  case 14:
112  {
113  // SSI_IEEE_FP_CONTROL
114  TypedBufferArg<uint64_t> fpcr(bufPtr);
115  // I don't think this exactly matches the HW FPCR
116  fpcr.copyIn(tc->getMemProxy());
117  DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): "
118  " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr));
119  return 0;
120  }
121  default:
122  cerr << "sys_setsysinfo: unknown op " << op << endl;
123  abort();
124  break;
125  }
126 
127  return 1;
128 }
129 
130 static SyscallReturn
131 setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process,
132  ThreadContext *tc)
133 {
134  int index = 0;
135  Addr addr = process->getSyscallArg(tc, index);
137  return 0;
138 }
139 
141  /* 0 */ SyscallDesc("syscall", unimplementedFunc),
142  /* 1 */ SyscallDesc("exit", exitFunc),
143  /* 2 */ SyscallDesc("fork", unimplementedFunc),
144  /* 3 */ SyscallDesc("read", readFunc),
145  /* 4 */ SyscallDesc("write", writeFunc),
146  /* 5 */ SyscallDesc("open", openFunc<MipsLinux>),
147  /* 6 */ SyscallDesc("close", closeFunc),
148  /* 7 */ SyscallDesc("waitpid", unimplementedFunc),
149  /* 8 */ SyscallDesc("creat", unimplementedFunc),
150  /* 9 */ SyscallDesc("link", unimplementedFunc),
151  /* 10 */ SyscallDesc("unlink", unlinkFunc),
152  /* 11 */ SyscallDesc("execve", unimplementedFunc),
153  /* 12 */ SyscallDesc("chdir", unimplementedFunc),
154  /* 13 */ SyscallDesc("time", unimplementedFunc),
155  /* 14 */ SyscallDesc("mknod", unimplementedFunc),
156  /* 15 */ SyscallDesc("chmod", chmodFunc<MipsLinux>),
157  /* 16 */ SyscallDesc("lchown", chownFunc),
158  /* 17 */ SyscallDesc("break", brkFunc),
159  /* 18 */ SyscallDesc("unused#18", unimplementedFunc),
160  /* 19 */ SyscallDesc("lseek", lseekFunc),
161  /* 20 */ SyscallDesc("getpid", getpidFunc),
162  /* 21 */ SyscallDesc("mount", unimplementedFunc),
163  /* 22 */ SyscallDesc("umount", unimplementedFunc),
164  /* 23 */ SyscallDesc("setuid", setuidFunc),
165  /* 24 */ SyscallDesc("getuid", getuidFunc),
166  /* 25 */ SyscallDesc("stime", unimplementedFunc),
167  /* 26 */ SyscallDesc("ptrace", unimplementedFunc),
168  /* 27 */ SyscallDesc("alarm", unimplementedFunc),
169  /* 28 */ SyscallDesc("unused#28", unimplementedFunc),
170  /* 29 */ SyscallDesc("pause", unimplementedFunc),
171  /* 30 */ SyscallDesc("utime", unimplementedFunc),
172  /* 31 */ SyscallDesc("stty", unimplementedFunc),
173  /* 32 */ SyscallDesc("gtty", unimplementedFunc),
174  /* 33 */ SyscallDesc("access", unimplementedFunc),
175  /* 34 */ SyscallDesc("nice", unimplementedFunc),
176  /* 35 */ SyscallDesc("ftime", unimplementedFunc),
177  /* 36 */ SyscallDesc("sync", unimplementedFunc),
178  /* 37 */ SyscallDesc("kill", unimplementedFunc),
179  /* 38 */ SyscallDesc("rename", unimplementedFunc),
180  /* 39 */ SyscallDesc("mkdir", mkdirFunc),
181  /* 40 */ SyscallDesc("rmdir", unimplementedFunc),
182  /* 41 */ SyscallDesc("dup", unimplementedFunc),
183  /* 42 */ SyscallDesc("pipe", pipePseudoFunc),
184  /* 43 */ SyscallDesc("times", unimplementedFunc),
185  /* 44 */ SyscallDesc("prof", unimplementedFunc),
186  /* 45 */ SyscallDesc("brk", brkFunc),
187  /* 46 */ SyscallDesc("setgid", unimplementedFunc),
188  /* 47 */ SyscallDesc("getgid", getgidFunc),
189  /* 48 */ SyscallDesc("signal", ignoreFunc),
190  /* 49 */ SyscallDesc("geteuid", geteuidFunc),
191  /* 50 */ SyscallDesc("getegid", getegidFunc),
192  /* 51 */ SyscallDesc("acct", unimplementedFunc),
193  /* 52 */ SyscallDesc("umount2", unimplementedFunc),
194  /* 53 */ SyscallDesc("lock", unimplementedFunc),
195  /* 54 */ SyscallDesc("ioctl", ioctlFunc<MipsLinux>),
196  /* 55 */ SyscallDesc("fcntl", fcntlFunc),
197  /* 56 */ SyscallDesc("mpx", unimplementedFunc),
198  /* 57 */ SyscallDesc("setpgid", unimplementedFunc),
199  /* 58 */ SyscallDesc("ulimit", unimplementedFunc),
200  /* 59 */ SyscallDesc("unused#59", unimplementedFunc),
201  /* 60 */ SyscallDesc("umask", umaskFunc),
202  /* 61 */ SyscallDesc("chroot", unimplementedFunc),
203  /* 62 */ SyscallDesc("ustat", unimplementedFunc),
204  /* 63 */ SyscallDesc("dup2", unimplementedFunc),
205  /* 64 */ SyscallDesc("getppid", getpagesizeFunc),
206  /* 65 */ SyscallDesc("getpgrp", unimplementedFunc),
207  /* 66 */ SyscallDesc("setsid", unimplementedFunc),
208  /* 67 */ SyscallDesc("sigaction",unimplementedFunc),
209  /* 68 */ SyscallDesc("sgetmask", unimplementedFunc),
210  /* 69 */ SyscallDesc("ssetmask", unimplementedFunc),
211  /* 70 */ SyscallDesc("setreuid", unimplementedFunc),
212  /* 71 */ SyscallDesc("setregid", unimplementedFunc),
213  /* 72 */ SyscallDesc("sigsuspend", unimplementedFunc),
214  /* 73 */ SyscallDesc("sigpending", unimplementedFunc),
215  /* 74 */ SyscallDesc("sethostname", ignoreFunc),
216  /* 75 */ SyscallDesc("setrlimit", unimplementedFunc),
217  /* 76 */ SyscallDesc("getrlimit", unimplementedFunc),
218  /* 77 */ SyscallDesc("getrusage", getrusageFunc<MipsLinux>),
219  /* 78 */ SyscallDesc("gettimeofday", unimplementedFunc),
220  /* 79 */ SyscallDesc("settimeofday", unimplementedFunc),
221  /* 80 */ SyscallDesc("getgroups", unimplementedFunc),
222  /* 81 */ SyscallDesc("setgroups", unimplementedFunc),
223  /* 82 */ SyscallDesc("reserved#82", unimplementedFunc),
224  /* 83 */ SyscallDesc("symlink", unimplementedFunc),
225  /* 84 */ SyscallDesc("unused#84", unimplementedFunc),
226  /* 85 */ SyscallDesc("readlink", readlinkFunc),
227  /* 86 */ SyscallDesc("uselib", unimplementedFunc),
228  /* 87 */ SyscallDesc("swapon", gethostnameFunc),
229  /* 88 */ SyscallDesc("reboot", unimplementedFunc),
230  /* 89 */ SyscallDesc("readdir", unimplementedFunc),
231  /* 90 */ SyscallDesc("mmap", mmapFunc<MipsLinux>),
232  /* 91 */ SyscallDesc("munmap",munmapFunc),
233  /* 92 */ SyscallDesc("truncate", truncateFunc),
234  /* 93 */ SyscallDesc("ftruncate", ftruncateFunc),
235  /* 94 */ SyscallDesc("fchmod", fchmodFunc<MipsLinux>),
236  /* 95 */ SyscallDesc("fchown", fchownFunc),
237  /* 96 */ SyscallDesc("getpriority", unimplementedFunc),
238  /* 97 */ SyscallDesc("setpriority", unimplementedFunc),
239  /* 98 */ SyscallDesc("profil", unimplementedFunc),
240  /* 99 */ SyscallDesc("statfs", unimplementedFunc),
241  /* 100 */ SyscallDesc("fstatfs", unimplementedFunc),
242  /* 101 */ SyscallDesc("ioperm", unimplementedFunc),
243  /* 102 */ SyscallDesc("socketcall", unimplementedFunc),
244  /* 103 */ SyscallDesc("syslog", unimplementedFunc),
245  /* 104 */ SyscallDesc("setitimer", unimplementedFunc),
246  /* 105 */ SyscallDesc("getitimer", unimplementedFunc),
247  /* 106 */ SyscallDesc("stat", statFunc<MipsLinux>),
248  /* 107 */ SyscallDesc("lstat", unimplementedFunc),
249  /* 108 */ SyscallDesc("fstat", fstatFunc<MipsLinux>),
250  /* 109 */ SyscallDesc("unused#109", unimplementedFunc),
251  /* 110 */ SyscallDesc("iopl", unimplementedFunc),
252  /* 111 */ SyscallDesc("vhangup", unimplementedFunc),
253  /* 112 */ SyscallDesc("idle", ignoreFunc),
254  /* 113 */ SyscallDesc("vm86", unimplementedFunc),
255  /* 114 */ SyscallDesc("wait4", unimplementedFunc),
256  /* 115 */ SyscallDesc("swapoff", unimplementedFunc),
257  /* 116 */ SyscallDesc("sysinfo", sysinfoFunc<MipsLinux>),
258  /* 117 */ SyscallDesc("ipc", unimplementedFunc),
259  /* 118 */ SyscallDesc("fsync", unimplementedFunc),
260  /* 119 */ SyscallDesc("sigreturn", unimplementedFunc),
261  /* 120 */ SyscallDesc("clone", unimplementedFunc),
262  /* 121 */ SyscallDesc("setdomainname", unimplementedFunc),
263  /* 122 */ SyscallDesc("uname", unameFunc),
264  /* 123 */ SyscallDesc("modify_ldt", unimplementedFunc),
265  /* 124 */ SyscallDesc("adjtimex", unimplementedFunc),
266  /* 125 */ SyscallDesc("mprotect", ignoreFunc),
267  /* 126 */ SyscallDesc("sigprocmask", unimplementedFunc),
268  /* 127 */ SyscallDesc("create_module", unimplementedFunc),
269  /* 128 */ SyscallDesc("init_module", unimplementedFunc),
270  /* 129 */ SyscallDesc("delete_module", unimplementedFunc),
271  /* 130 */ SyscallDesc("get_kernel_syms", unimplementedFunc),
272  /* 131 */ SyscallDesc("quotactl", unimplementedFunc),
273  /* 132 */ SyscallDesc("getpgid", unimplementedFunc),
274  /* 133 */ SyscallDesc("fchdir", unimplementedFunc),
275  /* 134 */ SyscallDesc("bdflush", unimplementedFunc),
276  /* 135 */ SyscallDesc("sysfs", unimplementedFunc),
277  /* 136 */ SyscallDesc("personality", unimplementedFunc),
278  /* 137 */ SyscallDesc("afs_syscall", unimplementedFunc),
279  /* 138 */ SyscallDesc("setfsuid", unimplementedFunc),
280  /* 139 */ SyscallDesc("setfsgid", unimplementedFunc),
281  /* 140 */ SyscallDesc("llseek", unimplementedFunc),
282  /* 141 */ SyscallDesc("getdents", unimplementedFunc),
283  /* 142 */ SyscallDesc("newselect", unimplementedFunc),
284  /* 143 */ SyscallDesc("flock", unimplementedFunc),
285  /* 144 */ SyscallDesc("msync", unimplementedFunc),
286  /* 145 */ SyscallDesc("readv", unimplementedFunc),
287  /* 146 */ SyscallDesc("writev", writevFunc<MipsLinux>),
288  /* 147 */ SyscallDesc("cacheflush", unimplementedFunc),
289  /* 148 */ SyscallDesc("cachectl", unimplementedFunc),
290  /* 149 */ SyscallDesc("sysmips", unimplementedFunc),
291  /* 150 */ SyscallDesc("unused#150", unimplementedFunc),
292  /* 151 */ SyscallDesc("getsid", unimplementedFunc),
293  /* 152 */ SyscallDesc("fdatasync", unimplementedFunc),
294  /* 153 */ SyscallDesc("sysctl", ignoreFunc),
295  /* 154 */ SyscallDesc("mlock", unimplementedFunc),
296  /* 155 */ SyscallDesc("munlock", unimplementedFunc),
297  /* 156 */ SyscallDesc("mlockall", unimplementedFunc),
298  /* 157 */ SyscallDesc("munlockall", unimplementedFunc),
299  /* 158 */ SyscallDesc("sched_setparam", unimplementedFunc),
300  /* 159 */ SyscallDesc("sched_getparam", unimplementedFunc),
301  /* 160 */ SyscallDesc("sched_setscheduler", unimplementedFunc),
302  /* 161 */ SyscallDesc("sched_getscheduler", unimplementedFunc),
303  /* 162 */ SyscallDesc("sched_yield", unimplementedFunc),
304  /* 163 */ SyscallDesc("sched_get_prioritymax", unimplementedFunc),
305  /* 164 */ SyscallDesc("sched_get_priority_min", unimplementedFunc),
306  /* 165 */ SyscallDesc("sched_rr_get_interval", unimplementedFunc),
307  /* 166 */ SyscallDesc("nanosleep", unimplementedFunc),
308  /* 167 */ SyscallDesc("mremap", mremapFunc<MipsLinux>),
309  /* 168 */ SyscallDesc("accept", unimplementedFunc),
310  /* 169 */ SyscallDesc("bind", unimplementedFunc),
311  /* 170 */ SyscallDesc("connect", unimplementedFunc),
312  /* 171 */ SyscallDesc("getpeername", unimplementedFunc),
313  /* 172 */ SyscallDesc("getsockname", unimplementedFunc),
314  /* 173 */ SyscallDesc("getsockopt", unimplementedFunc),
315  /* 174 */ SyscallDesc("listen", unimplementedFunc),
316  /* 175 */ SyscallDesc("recv", unimplementedFunc),
317  /* 176 */ SyscallDesc("recvmsg", unimplementedFunc),
318  /* 177 */ SyscallDesc("send", unimplementedFunc),
319  /* 178 */ SyscallDesc("sendmsg", ignoreFunc),
320  /* 179 */ SyscallDesc("sendto", unimplementedFunc),
321  /* 180 */ SyscallDesc("setsockopt", unimplementedFunc),
322  /* 181 */ SyscallDesc("shutdown", unimplementedFunc),
323  /* 182 */ SyscallDesc("unknown #182", unimplementedFunc),
324  /* 183 */ SyscallDesc("socket", ignoreFunc),
325  /* 184 */ SyscallDesc("socketpair", unimplementedFunc),
326  /* 185 */ SyscallDesc("setresuid", unimplementedFunc),
327  /* 186 */ SyscallDesc("getresuid", unimplementedFunc),
328  /* 187 */ SyscallDesc("query_module", unimplementedFunc),
329  /* 188 */ SyscallDesc("poll", unimplementedFunc),
330  /* 189 */ SyscallDesc("nfsservctl", unimplementedFunc),
331  /* 190 */ SyscallDesc("setresgid", unimplementedFunc),
332  /* 191 */ SyscallDesc("getresgid", unimplementedFunc),
333  /* 192 */ SyscallDesc("prctl", unimplementedFunc),
334  /* 193 */ SyscallDesc("rt_sigreturn", unimplementedFunc),
335  /* 194 */ SyscallDesc("rt_sigaction", unimplementedFunc),
336  /* 195 */ SyscallDesc("rt_sigprocmask", unimplementedFunc),
337  /* 196 */ SyscallDesc("rt_sigpending", unimplementedFunc),
338  /* 197 */ SyscallDesc("rt_sigtimedwait", unimplementedFunc),
339  /* 198 */ SyscallDesc("rt_sigqueueinfo", ignoreFunc),
340  /* 199 */ SyscallDesc("rt_sigsuspend", unimplementedFunc),
341  /* 200 */ SyscallDesc("pread64", unimplementedFunc),
342  /* 201 */ SyscallDesc("pwrite64", unimplementedFunc),
343  /* 202 */ SyscallDesc("chown", unimplementedFunc),
344  /* 203 */ SyscallDesc("getcwd", getcwdFunc),
345  /* 204 */ SyscallDesc("capget", unimplementedFunc),
346  /* 205 */ SyscallDesc("capset", unimplementedFunc),
347  /* 206 */ SyscallDesc("sigalstack", unimplementedFunc),
348  /* 207 */ SyscallDesc("sendfile", unimplementedFunc),
349  /* 208 */ SyscallDesc("getpmsg", unimplementedFunc),
350  /* 209 */ SyscallDesc("putpmsg", unimplementedFunc),
351  /* 210 */ SyscallDesc("mmap2", unimplementedFunc),
352  /* 211 */ SyscallDesc("truncate64", unimplementedFunc),
353  /* 212 */ SyscallDesc("ftruncate64", unimplementedFunc),
354  /* 213 */ SyscallDesc("stat64", unimplementedFunc),
355  /* 214 */ SyscallDesc("lstat64", lstat64Func<MipsLinux>),
356  /* 215 */ SyscallDesc("fstat64", fstat64Func<MipsLinux>),
357  /* 216 */ SyscallDesc("pivot_root", unimplementedFunc),
358  /* 217 */ SyscallDesc("mincore", unimplementedFunc),
359  /* 218 */ SyscallDesc("madvise", unimplementedFunc),
360  /* 219 */ SyscallDesc("getdents64", unimplementedFunc),
361  /* 220 */ SyscallDesc("fcntl64", fcntl64Func),
362  /* 221 */ SyscallDesc("reserved#221", unimplementedFunc),
363  /* 222 */ SyscallDesc("gettid", unimplementedFunc),
364  /* 223 */ SyscallDesc("readahead", unimplementedFunc),
365  /* 224 */ SyscallDesc("setxattr", unimplementedFunc),
366  /* 225 */ SyscallDesc("lsetxattr", unimplementedFunc),
367  /* 226 */ SyscallDesc("fsetxattr", unimplementedFunc),
368  /* 227 */ SyscallDesc("getxattr", unimplementedFunc),
369  /* 228 */ SyscallDesc("lgetxattr", unimplementedFunc),
370  /* 229 */ SyscallDesc("fgetxattr", unimplementedFunc),
371  /* 230 */ SyscallDesc("listxattr", unimplementedFunc),
372  /* 231 */ SyscallDesc("llistxattr", unimplementedFunc),
373  /* 232 */ SyscallDesc("flistxattr", unimplementedFunc),
374  /* 233 */ SyscallDesc("removexattr", unimplementedFunc),
375  /* 234 */ SyscallDesc("lremovexattr", unimplementedFunc),
376  /* 235 */ SyscallDesc("fremovexattr", ignoreFunc),
377  /* 236 */ SyscallDesc("tkill", unimplementedFunc),
378  /* 237 */ SyscallDesc("sendfile64", unimplementedFunc),
379  /* 238 */ SyscallDesc("futex", unimplementedFunc),
380  /* 239 */ SyscallDesc("sched_setaffinity", unimplementedFunc),
381  /* 240 */ SyscallDesc("sched_getaffinity", unimplementedFunc),
382  /* 241 */ SyscallDesc("io_setup", unimplementedFunc),
383  /* 242 */ SyscallDesc("io_destroy", unimplementedFunc),
384  /* 243 */ SyscallDesc("io_getevents", unimplementedFunc),
385  /* 244 */ SyscallDesc("io_submit", unimplementedFunc),
386  /* 245 */ SyscallDesc("io_cancel", unimplementedFunc),
387  /* 246 */ SyscallDesc("exit_group", exitFunc),
388  /* 247 */ SyscallDesc("lookup_dcookie", unimplementedFunc),
389  /* 248 */ SyscallDesc("epoll_create", unimplementedFunc),
390  /* 249 */ SyscallDesc("epoll_ctl", unimplementedFunc),
391  /* 250 */ SyscallDesc("epoll_wait", unimplementedFunc),
392  /* 251 */ SyscallDesc("remap_file_pages", unimplementedFunc),
393  /* 252 */ SyscallDesc("set_tid_address", unimplementedFunc),
394  /* 253 */ SyscallDesc("restart_syscall", unimplementedFunc),
395  /* 254 */ SyscallDesc("fadvise64", unimplementedFunc),
396  /* 255 */ SyscallDesc("statfs64", unimplementedFunc),
397  /* 256 */ SyscallDesc("fstafs64", unimplementedFunc),
398  /* 257 */ SyscallDesc("timer_create", sys_getsysinfoFunc),
399  /* 258 */ SyscallDesc("timer_settime", sys_setsysinfoFunc),
400  /* 259 */ SyscallDesc("timer_gettime", unimplementedFunc),
401  /* 260 */ SyscallDesc("timer_getoverrun", unimplementedFunc),
402  /* 261 */ SyscallDesc("timer_delete", unimplementedFunc),
403  /* 262 */ SyscallDesc("clock_settime", unimplementedFunc),
404  /* 263 */ SyscallDesc("clock_gettime", unimplementedFunc),
405  /* 264 */ SyscallDesc("clock_getres", unimplementedFunc),
406  /* 265 */ SyscallDesc("clock_nanosleep", unimplementedFunc),
407  /* 266 */ SyscallDesc("tgkill", unimplementedFunc),
408  /* 267 */ SyscallDesc("utimes", unimplementedFunc),
409  /* 268 */ SyscallDesc("mbind", unimplementedFunc),
410  /* 269 */ SyscallDesc("get_mempolicy", unimplementedFunc),
411  /* 270 */ SyscallDesc("set_mempolicy", unimplementedFunc),
412  /* 271 */ SyscallDesc("mq_open", unimplementedFunc),
413  /* 272 */ SyscallDesc("mq_unlink", unimplementedFunc),
414  /* 273 */ SyscallDesc("mq_timedsend", unimplementedFunc),
415  /* 274 */ SyscallDesc("mq_timedreceive", unimplementedFunc),
416  /* 275 */ SyscallDesc("mq_notify", unimplementedFunc),
417  /* 276 */ SyscallDesc("mq_getsetattr", unimplementedFunc),
418  /* 277 */ SyscallDesc("vserver", unimplementedFunc),
419  /* 278 */ SyscallDesc("waitid", unimplementedFunc),
420  /* 279 */ SyscallDesc("unknown #279", unimplementedFunc),
421  /* 280 */ SyscallDesc("add_key", unimplementedFunc),
422  /* 281 */ SyscallDesc("request_key", unimplementedFunc),
423  /* 282 */ SyscallDesc("keyctl", unimplementedFunc),
424  /* 283 */ SyscallDesc("set_thread_area", setThreadAreaFunc),
425  /* 284 */ SyscallDesc("inotify_init", unimplementedFunc),
426  /* 285 */ SyscallDesc("inotify_add_watch", unimplementedFunc),
427  /* 286 */ SyscallDesc("inotify_rm_watch", unimplementedFunc),
428  /* 287 */ SyscallDesc("migrate_pages", unimplementedFunc),
429  /* 288 */ SyscallDesc("openat", unimplementedFunc),
430  /* 289 */ SyscallDesc("mkdirat", unimplementedFunc),
431  /* 290 */ SyscallDesc("mknodat", unimplementedFunc),
432  /* 291 */ SyscallDesc("fchownat", unimplementedFunc),
433  /* 292 */ SyscallDesc("futimesat", unimplementedFunc),
434  /* 293 */ SyscallDesc("fstatat64", unimplementedFunc),
435  /* 294 */ SyscallDesc("unlinkat", unimplementedFunc),
436  /* 295 */ SyscallDesc("renameat", unimplementedFunc),
437  /* 296 */ SyscallDesc("linkat", unimplementedFunc),
438  /* 297 */ SyscallDesc("symlinkat", unimplementedFunc),
439  /* 298 */ SyscallDesc("readlinkat", unimplementedFunc),
440  /* 299 */ SyscallDesc("fchmodat", unimplementedFunc),
441  /* 300 */ SyscallDesc("faccessat", unimplementedFunc),
442  /* 301 */ SyscallDesc("pselect6", unimplementedFunc),
443  /* 302 */ SyscallDesc("ppoll", unimplementedFunc),
444  /* 303 */ SyscallDesc("unshare", unimplementedFunc),
445  /* 304 */ SyscallDesc("splice", unimplementedFunc),
446  /* 305 */ SyscallDesc("sync_file_range", unimplementedFunc),
447  /* 306 */ SyscallDesc("tee", unimplementedFunc),
448  /* 307 */ SyscallDesc("vmsplice", unimplementedFunc),
449  /* 308 */ SyscallDesc("move_pages", unimplementedFunc),
450  /* 309 */ SyscallDesc("set_robust_list", unimplementedFunc),
451  /* 310 */ SyscallDesc("get_robust_list", unimplementedFunc),
452  /* 311 */ SyscallDesc("kexec_load", unimplementedFunc),
453  /* 312 */ SyscallDesc("getcpu", unimplementedFunc),
454  /* 313 */ SyscallDesc("epoll_pwait", unimplementedFunc),
455  /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc),
456  /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc),
457  /* 316 */ SyscallDesc("utimensat", unimplementedFunc),
458  /* 317 */ SyscallDesc("signalfd", unimplementedFunc),
459  /* 318 */ SyscallDesc("timerfd", unimplementedFunc),
460  /* 319 */ SyscallDesc("eventfd", unimplementedFunc)
461 };
462 
463 MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params,
464  ObjectFile *objFile)
465  : MipsProcess(params, objFile),
466  Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
467 { }
468 
471 {
472  //MIPS32 syscalls are in the range of 4000 - 4999
473  int m5_sys_idx = callnum - 4000;
474 
475  if (m5_sys_idx < 0 || m5_sys_idx >= Num_Syscall_Descs)
476  return NULL;
477 
478  return &syscallDescs[m5_sys_idx];
479 }
480 
481 
482 
483 
484 
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.
static SyscallReturn sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target sys_setsysinfo() handler.
Definition: process.cc:101
const std::string & name()
Definition: trace.cc:49
SyscallReturn getcwdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target getcwd() handler.
bool copyIn(SETranslatingPortProxy &memproxy)
copy data into simulator space (read from target memory)
ip6_addr_t addr
Definition: inet.hh:335
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.
SyscallReturn readlinkFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
virtual TheISA::IntReg getSyscallArg(ThreadContext *tc, int &i)=0
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.
T gtoh(T value)
Definition: byteswap.hh:179
SyscallReturn fcntlFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target fcntl() handler.
bool copyOut(SETranslatingPortProxy &memproxy)
copy data out of simulator space (write to target memory)
static SyscallDesc syscallDescs[]
Array of syscall descriptors, indexed by call number.
Definition: process.hh:55
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
SyscallReturn lseekFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target lseek() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target fchown() handler.
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
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SyscallReturn mkdirFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target mkdir() handler.
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.
virtual SyscallDesc * getDesc(int callnum)
Definition: process.cc:470
SyscallReturn pipePseudoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Pseudo Funcs - These functions use a different return convension, returning a second value in a regis...
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.
static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target uname() handler.
Definition: process.cc:52
static SyscallReturn setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Definition: process.cc:131
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.
const int Num_Syscall_Descs
Definition: process.hh:56
SyscallReturn exitFunc(SyscallDesc *desc, int callnum, Process *p, ThreadContext *tc)
Target exit() handler: terminate current context.
SyscallReturn closeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
Target close() handler.
Bitfield< 4 > op
Definition: types.hh:80
This class represents the return value from an emulated system call, including any errno setting...
virtual void setMiscRegNoEffect(int misc_reg, const MiscReg &val)=0
MipsLinuxProcess(ProcessParams *params, ObjectFile *objFile)
Constructor.
Definition: process.cc:463
SyscallReturn readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc)
static SyscallReturn sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc)
Target sys_getsysyinfo() handler.
Definition: process.cc:72
#define DPRINTFR(...)
Definition: trace.hh:214

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