gem5  v19.0.0.0
process.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2005 The Regents of The University of Michigan
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * Authors: Steve Reinhardt
29  * Ali Saidi
30  */
31 
33 
34 #include "arch/alpha/isa_traits.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/process.hh"
42 #include "sim/syscall_desc.hh"
43 #include "sim/syscall_emul.hh"
44 
45 using namespace std;
46 using namespace AlphaISA;
47 
48 namespace
49 {
50 
51 class AlphaLinuxObjectFileLoader : public Process::Loader
52 {
53  public:
54  Process *
55  load(ProcessParams *params, ObjectFile *obj_file) override
56  {
57  if (obj_file->getArch() != ObjectFile::Alpha)
58  return nullptr;
59 
60  auto opsys = obj_file->getOpSys();
61 
62  if (opsys == ObjectFile::UnknownOpSys) {
63  warn("Unknown operating system; assuming Linux.");
64  opsys = ObjectFile::Linux;
65  }
66 
67  if (opsys != ObjectFile::Linux)
68  return nullptr;
69 
70  return new AlphaLinuxProcess(params, obj_file);
71  }
72 };
73 
74 AlphaLinuxObjectFileLoader loader;
75 
76 } // anonymous namespace
77 
79 static SyscallReturn
80 unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
81 {
82  int index = 0;
83  auto process = tc->getProcessPtr();
84  TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
85 
86  strcpy(name->sysname, "Linux");
87  strcpy(name->nodename, "sim.gem5.org");
88  strcpy(name->release, process->release.c_str());
89  strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
90  strcpy(name->machine, "alpha");
91 
92  name.copyOut(tc->getVirtProxy());
93  return 0;
94 }
95 
99 static SyscallReturn
101 {
102  int index = 0;
103  auto process = tc->getProcessPtr();
104  unsigned op = process->getSyscallArg(tc, index);
105  Addr bufPtr = process->getSyscallArg(tc, index);
106  // unsigned nbytes = process->getSyscallArg(tc, 2);
107 
108  switch (op) {
109 
110  case 45: { // GSI_IEEE_FP_CONTROL
111  TypedBufferArg<uint64_t> fpcr(bufPtr);
112  // I don't think this exactly matches the HW FPCR
113  *fpcr = 0;
114  fpcr.copyOut(tc->getVirtProxy());
115  return 0;
116  }
117 
118  default:
119  cerr << "osf_getsysinfo: unknown op " << op << endl;
120  abort();
121  break;
122  }
123 
124  return 1;
125 }
126 
128 static SyscallReturn
130 {
131  int index = 0;
132  auto process = tc->getProcessPtr();
133  unsigned op = process->getSyscallArg(tc, index);
134  Addr bufPtr = process->getSyscallArg(tc, index);
135  // unsigned nbytes = process->getSyscallArg(tc, 2);
136 
137  switch (op) {
138 
139  case 14: { // SSI_IEEE_FP_CONTROL
140  TypedBufferArg<uint64_t> fpcr(bufPtr);
141  // I don't think this exactly matches the HW FPCR
142  fpcr.copyIn(tc->getVirtProxy());
143  DPRINTFR(SyscallVerbose, "osf_setsysinfo(SSI_IEEE_FP_CONTROL): "
144  " setting FPCR to 0x%x\n", letoh(*(uint64_t*)fpcr));
145  return 0;
146  }
147 
148  default:
149  cerr << "osf_setsysinfo: unknown op " << op << endl;
150  abort();
151  break;
152  }
153 
154  return 1;
155 }
156 
157 
158 SyscallDescABI<DefaultSyscallABI> AlphaLinuxProcess::syscallDescs[] = {
159  /* 0 */ { "osf_syscall" },
160  /* 1 */ { "exit", exitFunc },
161  /* 2 */ { "fork" },
162  /* 3 */ { "read", readFunc<AlphaLinux> },
163  /* 4 */ { "write", writeFunc<AlphaLinux> },
164  /* 5 */ { "osf_old_open" },
165  /* 6 */ { "close", closeFunc },
166  /* 7 */ { "osf_wait4" },
167  /* 8 */ { "osf_old_creat" },
168  /* 9 */ { "link" },
169  /* 10 */ { "unlink", unlinkFunc },
170  /* 11 */ { "osf_execve" },
171  /* 12 */ { "chdir" },
172  /* 13 */ { "fchdir" },
173  /* 14 */ { "mknod" },
174  /* 15 */ { "chmod", chmodFunc<AlphaLinux> },
175  /* 16 */ { "chown", chownFunc },
176  /* 17 */ { "brk", brkFunc },
177  /* 18 */ { "osf_getfsstat" },
178  /* 19 */ { "lseek", lseekFunc },
179  /* 20 */ { "getxpid", getpidPseudoFunc },
180  /* 21 */ { "osf_mount" },
181  /* 22 */ { "umount" },
182  /* 23 */ { "setuid", ignoreFunc },
183  /* 24 */ { "getxuid", getuidPseudoFunc },
184  /* 25 */ { "exec_with_loader" },
185  /* 26 */ { "osf_ptrace" },
186  /* 27 */ { "osf_nrecvmsg" },
187  /* 28 */ { "osf_nsendmsg" },
188  /* 29 */ { "osf_nrecvfrom" },
189  /* 30 */ { "osf_naccept" },
190  /* 31 */ { "osf_ngetpeername" },
191  /* 32 */ { "osf_ngetsockname" },
192  /* 33 */ { "access" },
193  /* 34 */ { "osf_chflags" },
194  /* 35 */ { "osf_fchflags" },
195  /* 36 */ { "sync" },
196  /* 37 */ { "kill" },
197  /* 38 */ { "osf_old_stat" },
198  /* 39 */ { "setpgid" },
199  /* 40 */ { "osf_old_lstat" },
200  /* 41 */ { "dup", dupFunc },
201  /* 42 */ { "pipe", pipePseudoFunc },
202  /* 43 */ { "osf_set_program_attributes" },
203  /* 44 */ { "osf_profil" },
204  /* 45 */ { "open", openFunc<AlphaLinux> },
205  /* 46 */ { "osf_old_sigaction" },
206  /* 47 */ { "getxgid", getgidPseudoFunc },
207  /* 48 */ { "osf_sigprocmask", ignoreFunc },
208  /* 49 */ { "osf_getlogin" },
209  /* 50 */ { "osf_setlogin" },
210  /* 51 */ { "acct" },
211  /* 52 */ { "sigpending" },
212  /* 53 */ { "osf_classcntl" },
213  /* 54 */ { "ioctl", ioctlFunc<AlphaLinux> },
214  /* 55 */ { "osf_reboot" },
215  /* 56 */ { "osf_revoke" },
216  /* 57 */ { "symlink" },
217  /* 58 */ { "readlink", readlinkFunc },
218  /* 59 */ { "execve" },
219  /* 60 */ { "umask", umaskFunc },
220  /* 61 */ { "chroot" },
221  /* 62 */ { "osf_old_fstat" },
222  /* 63 */ { "getpgrp" },
223  /* 64 */ { "getpagesize", getpagesizeFunc },
224  /* 65 */ { "osf_mremap" },
225  /* 66 */ { "vfork" },
226  /* 67 */ { "stat", statFunc<AlphaLinux> },
227  /* 68 */ { "lstat", lstatFunc<AlphaLinux> },
228  /* 69 */ { "osf_sbrk" },
229  /* 70 */ { "osf_sstk" },
230  /* 71 */ { "mmap", mmapFunc<AlphaLinux> },
231  /* 72 */ { "osf_old_vadvise" },
232  /* 73 */ { "munmap", munmapFunc },
233  /* 74 */ { "mprotect", ignoreFunc },
234  /* 75 */ { "madvise" },
235  /* 76 */ { "vhangup" },
236  /* 77 */ { "osf_kmodcall" },
237  /* 78 */ { "osf_mincore" },
238  /* 79 */ { "getgroups" },
239  /* 80 */ { "setgroups" },
240  /* 81 */ { "osf_old_getpgrp" },
241  /* 82 */ { "setpgrp" },
242  /* 83 */ { "osf_setitimer" },
243  /* 84 */ { "osf_old_wait" },
244  /* 85 */ { "osf_table" },
245  /* 86 */ { "osf_getitimer" },
246  /* 87 */ { "gethostname", gethostnameFunc },
247  /* 88 */ { "sethostname" },
248  /* 89 */ { "getdtablesize" },
249  /* 90 */ { "dup2" },
250  /* 91 */ { "fstat", fstatFunc<AlphaLinux> },
251  /* 92 */ { "fcntl", fcntlFunc },
252  /* 93 */ { "osf_select" },
253  /* 94 */ { "poll" },
254  /* 95 */ { "fsync" },
255  /* 96 */ { "setpriority" },
256  /* 97 */ { "socket" },
257  /* 98 */ { "connect" },
258  /* 99 */ { "accept" },
259  /* 100 */ { "getpriority" },
260  /* 101 */ { "send" },
261  /* 102 */ { "recv" },
262  /* 103 */ { "sigreturn" },
263  /* 104 */ { "bind" },
264  /* 105 */ { "setsockopt" },
265  /* 106 */ { "listen" },
266  /* 107 */ { "osf_plock" },
267  /* 108 */ { "osf_old_sigvec" },
268  /* 109 */ { "osf_old_sigblock" },
269  /* 110 */ { "osf_old_sigsetmask" },
270  /* 111 */ { "sigsuspend" },
271  /* 112 */ { "osf_sigstack", ignoreFunc },
272  /* 113 */ { "recvmsg" },
273  /* 114 */ { "sendmsg" },
274  /* 115 */ { "osf_old_vtrace" },
275  /* 116 */ { "osf_gettimeofday" },
276  /* 117 */ { "osf_getrusage" },
277  /* 118 */ { "getsockopt" },
278  /* 119 */ { "numa_syscalls" },
279  /* 120 */ { "readv" },
280  /* 121 */ { "writev", writevFunc<AlphaLinux> },
281  /* 122 */ { "osf_settimeofday" },
282  /* 123 */ { "fchown", fchownFunc },
283  /* 124 */ { "fchmod", fchmodFunc<AlphaLinux> },
284  /* 125 */ { "recvfrom" },
285  /* 126 */ { "setreuid" },
286  /* 127 */ { "setregid" },
287  /* 128 */ { "rename", renameFunc },
288  /* 129 */ { "truncate", truncateFunc },
289  /* 130 */ { "ftruncate", ftruncateFunc },
290  /* 131 */ { "flock" },
291  /* 132 */ { "setgid" },
292  /* 133 */ { "sendto" },
293  /* 134 */ { "shutdown" },
294  /* 135 */ { "socketpair" },
295  /* 136 */ { "mkdir", mkdirFunc },
296  /* 137 */ { "rmdir" },
297  /* 138 */ { "osf_utimes" },
298  /* 139 */ { "osf_old_sigreturn" },
299  /* 140 */ { "osf_adjtime" },
300  /* 141 */ { "getpeername" },
301  /* 142 */ { "osf_gethostid" },
302  /* 143 */ { "osf_sethostid" },
303  /* 144 */ { "getrlimit", getrlimitFunc<AlphaLinux> },
304  /* 145 */ { "setrlimit", ignoreFunc },
305  /* 146 */ { "osf_old_killpg" },
306  /* 147 */ { "setsid" },
307  /* 148 */ { "quotactl" },
308  /* 149 */ { "osf_oldquota" },
309  /* 150 */ { "getsockname" },
310  /* 151 */ { "osf_pread" },
311  /* 152 */ { "osf_pwrite" },
312  /* 153 */ { "osf_pid_block" },
313  /* 154 */ { "osf_pid_unblock" },
314  /* 155 */ { "osf_signal_urti" },
315  /* 156 */ { "sigaction", ignoreFunc },
316  /* 157 */ { "osf_sigwaitprim" },
317  /* 158 */ { "osf_nfssvc" },
318  /* 159 */ { "osf_getdirentries" },
319  /* 160 */ { "osf_statfs" },
320  /* 161 */ { "osf_fstatfs" },
321  /* 162 */ { "unknown #162" },
322  /* 163 */ { "osf_async_daemon" },
323  /* 164 */ { "osf_getfh" },
324  /* 165 */ { "osf_getdomainname" },
325  /* 166 */ { "setdomainname" },
326  /* 167 */ { "unknown #167" },
327  /* 168 */ { "unknown #168" },
328  /* 169 */ { "osf_exportfs" },
329  /* 170 */ { "unknown #170" },
330  /* 171 */ { "unknown #171" },
331  /* 172 */ { "unknown #172" },
332  /* 173 */ { "unknown #173" },
333  /* 174 */ { "unknown #174" },
334  /* 175 */ { "unknown #175" },
335  /* 176 */ { "unknown #176" },
336  /* 177 */ { "unknown #177" },
337  /* 178 */ { "unknown #178" },
338  /* 179 */ { "unknown #179" },
339  /* 180 */ { "unknown #180" },
340  /* 181 */ { "osf_alt_plock" },
341  /* 182 */ { "unknown #182" },
342  /* 183 */ { "unknown #183" },
343  /* 184 */ { "osf_getmnt" },
344  /* 185 */ { "unknown #185" },
345  /* 186 */ { "unknown #186" },
346  /* 187 */ { "osf_alt_sigpending" },
347  /* 188 */ { "osf_alt_setsid" },
348  /* 189 */ { "unknown #189" },
349  /* 190 */ { "unknown #190" },
350  /* 191 */ { "unknown #191" },
351  /* 192 */ { "unknown #192" },
352  /* 193 */ { "unknown #193" },
353  /* 194 */ { "unknown #194" },
354  /* 195 */ { "unknown #195" },
355  /* 196 */ { "unknown #196" },
356  /* 197 */ { "unknown #197" },
357  /* 198 */ { "unknown #198" },
358  /* 199 */ { "osf_swapon" },
359  /* 200 */ { "msgctl" },
360  /* 201 */ { "msgget" },
361  /* 202 */ { "msgrcv" },
362  /* 203 */ { "msgsnd" },
363  /* 204 */ { "semctl" },
364  /* 205 */ { "semget" },
365  /* 206 */ { "semop" },
366  /* 207 */ { "osf_utsname" },
367  /* 208 */ { "lchown" },
368  /* 209 */ { "osf_shmat" },
369  /* 210 */ { "shmctl" },
370  /* 211 */ { "shmdt" },
371  /* 212 */ { "shmget" },
372  /* 213 */ { "osf_mvalid" },
373  /* 214 */ { "osf_getaddressconf" },
374  /* 215 */ { "osf_msleep" },
375  /* 216 */ { "osf_mwakeup" },
376  /* 217 */ { "msync" },
377  /* 218 */ { "osf_signal" },
378  /* 219 */ { "osf_utc_gettime" },
379  /* 220 */ { "osf_utc_adjtime" },
380  /* 221 */ { "unknown #221" },
381  /* 222 */ { "osf_security" },
382  /* 223 */ { "osf_kloadcall" },
383  /* 224 */ { "unknown #224" },
384  /* 225 */ { "unknown #225" },
385  /* 226 */ { "unknown #226" },
386  /* 227 */ { "unknown #227" },
387  /* 228 */ { "unknown #228" },
388  /* 229 */ { "unknown #229" },
389  /* 230 */ { "unknown #230" },
390  /* 231 */ { "unknown #231" },
391  /* 232 */ { "unknown #232" },
392  /* 233 */ { "getpgid" },
393  /* 234 */ { "getsid" },
394  /* 235 */ { "sigaltstack", ignoreFunc },
395  /* 236 */ { "osf_waitid" },
396  /* 237 */ { "osf_priocntlset" },
397  /* 238 */ { "osf_sigsendset" },
398  /* 239 */ { "osf_set_speculative" },
399  /* 240 */ { "osf_msfs_syscall" },
400  /* 241 */ { "osf_sysinfo" },
401  /* 242 */ { "osf_uadmin" },
402  /* 243 */ { "osf_fuser" },
403  /* 244 */ { "osf_proplist_syscall" },
404  /* 245 */ { "osf_ntp_adjtime" },
405  /* 246 */ { "osf_ntp_gettime" },
406  /* 247 */ { "osf_pathconf" },
407  /* 248 */ { "osf_fpathconf" },
408  /* 249 */ { "unknown #249" },
409  /* 250 */ { "osf_uswitch" },
410  /* 251 */ { "osf_usleep_thread" },
411  /* 252 */ { "osf_audcntl" },
412  /* 253 */ { "osf_audgen" },
413  /* 254 */ { "sysfs" },
414  /* 255 */ { "osf_subsys_info" },
415  /* 256 */ { "osf_getsysinfo", osf_getsysinfoFunc },
416  /* 257 */ { "osf_setsysinfo", osf_setsysinfoFunc },
417  /* 258 */ { "osf_afs_syscall" },
418  /* 259 */ { "osf_swapctl" },
419  /* 260 */ { "osf_memcntl" },
420  /* 261 */ { "osf_fdatasync" },
421  /* 262 */ { "unknown #262" },
422  /* 263 */ { "unknown #263" },
423  /* 264 */ { "unknown #264" },
424  /* 265 */ { "unknown #265" },
425  /* 266 */ { "unknown #266" },
426  /* 267 */ { "unknown #267" },
427  /* 268 */ { "unknown #268" },
428  /* 269 */ { "unknown #269" },
429  /* 270 */ { "unknown #270" },
430  /* 271 */ { "unknown #271" },
431  /* 272 */ { "unknown #272" },
432  /* 273 */ { "unknown #273" },
433  /* 274 */ { "unknown #274" },
434  /* 275 */ { "unknown #275" },
435  /* 276 */ { "unknown #276" },
436  /* 277 */ { "unknown #277" },
437  /* 278 */ { "unknown #278" },
438  /* 279 */ { "unknown #279" },
439  /* 280 */ { "unknown #280" },
440  /* 281 */ { "unknown #281" },
441  /* 282 */ { "unknown #282" },
442  /* 283 */ { "unknown #283" },
443  /* 284 */ { "unknown #284" },
444  /* 285 */ { "unknown #285" },
445  /* 286 */ { "unknown #286" },
446  /* 287 */ { "unknown #287" },
447  /* 288 */ { "unknown #288" },
448  /* 289 */ { "unknown #289" },
449  /* 290 */ { "unknown #290" },
450  /* 291 */ { "unknown #291" },
451  /* 292 */ { "unknown #292" },
452  /* 293 */ { "unknown #293" },
453  /* 294 */ { "unknown #294" },
454  /* 295 */ { "unknown #295" },
455  /* 296 */ { "unknown #296" },
456  /* 297 */ { "unknown #297" },
457  /* 298 */ { "unknown #298" },
458  /* 299 */ { "unknown #299" },
459 /*
460  * Linux-specific system calls begin at 300
461  */
462  /* 300 */ { "bdflush" },
463  /* 301 */ { "sethae" },
464  /* 302 */ { "mount" },
465  /* 303 */ { "old_adjtimex" },
466  /* 304 */ { "swapoff" },
467  /* 305 */ { "getdents" },
468  /* 306 */ { "create_module" },
469  /* 307 */ { "init_module" },
470  /* 308 */ { "delete_module" },
471  /* 309 */ { "get_kernel_syms" },
472  /* 310 */ { "syslog" },
473  /* 311 */ { "reboot" },
474  /* 312 */ { "clone", cloneFunc<AlphaLinux> },
475  /* 313 */ { "uselib" },
476  /* 314 */ { "mlock" },
477  /* 315 */ { "munlock" },
478  /* 316 */ { "mlockall" },
479  /* 317 */ { "munlockall" },
480  /* 318 */ { "sysinfo", sysinfoFunc<AlphaLinux> },
481  /* 319 */ { "_sysctl" },
482  /* 320 */ { "was sys_idle" },
483  /* 321 */ { "oldumount" },
484  /* 322 */ { "swapon" },
485  /* 323 */ { "times", ignoreFunc },
486  /* 324 */ { "personality" },
487  /* 325 */ { "setfsuid" },
488  /* 326 */ { "setfsgid" },
489  /* 327 */ { "ustat" },
490  /* 328 */ { "statfs" },
491  /* 329 */ { "fstatfs" },
492  /* 330 */ { "sched_setparam" },
493  /* 331 */ { "sched_getparam" },
494  /* 332 */ { "sched_setscheduler" },
495  /* 333 */ { "sched_getscheduler" },
496  /* 334 */ { "sched_yield" },
497  /* 335 */ { "sched_get_priority_max" },
498  /* 336 */ { "sched_get_priority_min" },
499  /* 337 */ { "sched_rr_get_interval" },
500  /* 338 */ { "afs_syscall" },
501  /* 339 */ { "uname", unameFunc },
502  /* 340 */ { "nanosleep" },
503  /* 341 */ { "mremap", mremapFunc<AlphaLinux> },
504  /* 342 */ { "nfsservctl" },
505  /* 343 */ { "setresuid" },
506  /* 344 */ { "getresuid" },
507  /* 345 */ { "pciconfig_read" },
508  /* 346 */ { "pciconfig_write" },
509  /* 347 */ { "query_module" },
510  /* 348 */ { "prctl" },
511  /* 349 */ { "pread" },
512  /* 350 */ { "pwrite" },
513  /* 351 */ { "rt_sigreturn" },
514  /* 352 */ { "rt_sigaction", ignoreFunc },
515  /* 353 */ { "rt_sigprocmask" },
516  /* 354 */ { "rt_sigpending" },
517  /* 355 */ { "rt_sigtimedwait" },
518  /* 356 */ { "rt_sigqueueinfo" },
519  /* 357 */ { "rt_sigsuspend" },
520  /* 358 */ { "select" },
521  /* 359 */ { "gettimeofday", gettimeofdayFunc<AlphaLinux> },
522  /* 360 */ { "settimeofday" },
523  /* 361 */ { "getitimer" },
524  /* 362 */ { "setitimer" },
525  /* 363 */ { "utimes", utimesFunc<AlphaLinux> },
526  /* 364 */ { "getrusage", getrusageFunc<AlphaLinux> },
527  /* 365 */ { "wait4" },
528  /* 366 */ { "adjtimex" },
529  /* 367 */ { "getcwd", getcwdFunc },
530  /* 368 */ { "capget" },
531  /* 369 */ { "capset" },
532  /* 370 */ { "sendfile" },
533  /* 371 */ { "setresgid" },
534  /* 372 */ { "getresgid" },
535  /* 373 */ { "dipc" },
536  /* 374 */ { "pivot_root" },
537  /* 375 */ { "mincore" },
538  /* 376 */ { "pciconfig_iobase" },
539  /* 377 */ { "getdents64" },
540  /* 378 */ { "gettid" },
541  /* 379 */ { "readahead" },
542  /* 380 */ { "security" },
543  /* 381 */ { "tkill" },
544  /* 382 */ { "setxattr" },
545  /* 383 */ { "lsetxattr" },
546  /* 384 */ { "fsetxattr" },
547  /* 385 */ { "getxattr" },
548  /* 386 */ { "lgetxattr" },
549  /* 387 */ { "fgetxattr" },
550  /* 388 */ { "listxattr" },
551  /* 389 */ { "llistxattr" },
552  /* 390 */ { "flistxattr" },
553  /* 391 */ { "removexattr" },
554  /* 392 */ { "lremovexattr" },
555  /* 393 */ { "fremovexattr" },
556  /* 394 */ { "futex" },
557  /* 395 */ { "sched_setaffinity" },
558  /* 396 */ { "sched_getaffinity" },
559  /* 397 */ { "tuxcall" },
560  /* 398 */ { "io_setup" },
561  /* 399 */ { "io_destroy" },
562  /* 400 */ { "io_getevents" },
563  /* 401 */ { "io_submit" },
564  /* 402 */ { "io_cancel" },
565  /* 403 */ { "unknown #403" },
566  /* 404 */ { "unknown #404" },
567  /* 405 */ { "exit_group", exitGroupFunc }, // exit all threads...
568  /* 406 */ { "lookup_dcookie" },
569  /* 407 */ { "sys_epoll_create" },
570  /* 408 */ { "sys_epoll_ctl" },
571  /* 409 */ { "sys_epoll_wait" },
572  /* 410 */ { "remap_file_pages" },
573  /* 411 */ { "set_tid_address" },
574  /* 412 */ { "restart_syscall" },
575  /* 413 */ { "fadvise64" },
576  /* 414 */ { "timer_create" },
577  /* 415 */ { "timer_settime" },
578  /* 416 */ { "timer_gettime" },
579  /* 417 */ { "timer_getoverrun" },
580  /* 418 */ { "timer_delete" },
581  /* 419 */ { "clock_settime" },
582  /* 420 */ { "clock_gettime" },
583  /* 421 */ { "clock_getres" },
584  /* 422 */ { "clock_nanosleep" },
585  /* 423 */ { "semtimedop" },
586  /* 424 */ { "tgkill" },
587  /* 425 */ { "stat64", stat64Func<AlphaLinux> },
588  /* 426 */ { "lstat64", lstat64Func<AlphaLinux> },
589  /* 427 */ { "fstat64", fstat64Func<AlphaLinux> },
590  /* 428 */ { "vserver" },
591  /* 429 */ { "mbind" },
592  /* 430 */ { "get_mempolicy" },
593  /* 431 */ { "set_mempolicy" },
594  /* 432 */ { "mq_open" },
595  /* 433 */ { "mq_unlink" },
596  /* 434 */ { "mq_timedsend" },
597  /* 435 */ { "mq_timedreceive" },
598  /* 436 */ { "mq_notify" },
599  /* 437 */ { "mq_getsetattr" },
600  /* 438 */ { "waitid" },
601  /* 439 */ { "add_key" },
602  /* 440 */ { "request_key" },
603  /* 441 */ { "keyctl" }
604 };
605 
606 AlphaLinuxProcess::AlphaLinuxProcess(ProcessParams * params,
607  ObjectFile *objFile)
608  : AlphaProcess(params, objFile),
609  Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc))
610 {
611  //init_regs->intRegFile[0] = 0;
612 }
613 
614 
615 
618 {
619  if (callnum < 0 || callnum >= Num_Syscall_Descs)
620  return NULL;
621  return &syscallDescs[callnum];
622 }
623 
624 void
626 {
627  doSyscall(tc->readIntReg(0), tc, fault);
628 }
629 
Bitfield< 30, 0 > index
Arch getArch() const
Definition: object_file.hh:124
const std::string & name()
Definition: trace.cc:54
SyscallReturn ignoreFunc(SyscallDesc *desc, int callnum, 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:77
SyscallReturn getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr buf_ptr, unsigned long size)
Target getcwd() handler.
virtual RegVal readIntReg(RegIndex reg_idx) const =0
bool copyIn(PortProxy &memproxy)
copy data into simulator space (read from target memory)
virtual PortProxy & getVirtProxy()=0
virtual Process * getProcessPtr()=0
SyscallReturn fcntlFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target fcntl() handler.
Overload hash function for BasicBlockRange type.
Definition: vec_reg.hh:586
void doSyscall(int64_t callnum, ThreadContext *tc, Fault *fault)
Definition: process.cc:430
SyscallReturn getuidPseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getuidPseudo() handler.
T letoh(T value)
Definition: byteswap.hh:145
SyscallReturn getgidPseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getgidPseudo() 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 closeFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd)
Target close() handler.
SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr buf_ptr, int name_len)
Target gethostname() handler.
SyscallReturn renameFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr oldpath, Addr newpath)
Target rename() handler.
SyscallReturn umaskFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target umask() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target munmap() handler.
static SyscallReturn osf_setsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target osf_setsysinfo() handler.
Definition: process.cc:129
SyscallReturn unlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname)
Target unlink() handler.
SyscallReturn fchownFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint32_t owner, uint32_t group)
Target fchown() handler.
SyscallReturn exitGroupFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
SyscallReturn mkdirFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn getpidPseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getpidPseudo() handler.
SyscallDesc * getDesc(int callnum) override
Definition: process.cc:617
SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, Addr buf_ptr, size_t bufsiz)
Target readlink() handler.
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, off_t length)
Target ftruncate() handler.
void syscall(ThreadContext *tc, Fault *fault) override
Definition: process.cc:625
SyscallReturn brkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr new_brk)
Target brk() handler: set brk address.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
SyscallReturn dupFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd)
FIXME: The file description is not shared among file descriptors created with dup.
SyscallReturn getpagesizeFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target getpagesize() handler.
This class provides the wrapper interface for the system call implementations which are defined in th...
Definition: syscall_desc.hh:69
SyscallReturn truncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, off_t length)
Target truncate() handler.
SyscallReturn lseekFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
static SyscallReturn osf_getsysinfoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target osf_getsysyinfo() handler.
Definition: process.cc:100
This file defines objects used to emulate syscalls from the target application on the host machine...
A process with emulated Alpha/Linux syscalls.
Definition: process.hh:41
bool copyOut(PortProxy &memproxy)
copy data out of simulator space (write to target memory)
OpSys getOpSys() const
Definition: object_file.hh:125
static SyscallDescABI< DefaultSyscallABI > syscallDescs[]
Array of syscall descriptors, indexed by call number.
Definition: process.hh:52
SyscallReturn chownFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, uint32_t owner, uint32_t group)
Target chown() handler.
#define warn(...)
Definition: logging.hh:212
SyscallReturn pipePseudoFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Pseudo Funcs - These functions use a different return convension, returning a second value in a regis...
Bitfield< 4 > op
Definition: types.hh:80
This class represents the return value from an emulated system call, including any errno setting...
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
Definition: process.hh:191
static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target uname() handler.
Definition: process.cc:80
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
SyscallReturn exitFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
#define DPRINTFR(...)
Definition: trace.hh:231

Generated on Fri Feb 28 2020 16:26:56 for gem5 by doxygen 1.8.13