gem5  v19.0.0.0
process.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 The Hewlett-Packard Development Company
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * Authors: Gabe Black
38  */
39 
41 
42 #include <sys/syscall.h>
43 
44 #include "arch/x86/isa_traits.hh"
45 #include "arch/x86/linux/linux.hh"
46 #include "arch/x86/registers.hh"
48 #include "base/trace.hh"
49 #include "cpu/thread_context.hh"
50 #include "kern/linux/linux.hh"
51 #include "sim/process.hh"
52 #include "sim/syscall_desc.hh"
53 #include "sim/syscall_emul.hh"
54 
55 using namespace std;
56 using namespace X86ISA;
57 
58 namespace
59 {
60 
61 class X86LinuxObjectFileLoader : public Process::Loader
62 {
63  public:
64  Process *
65  load(ProcessParams *params, ObjectFile *obj_file) override
66  {
67  auto arch = obj_file->getArch();
68  auto opsys = obj_file->getOpSys();
69 
70  if (arch != ObjectFile::X86_64 && arch != ObjectFile::I386)
71  return nullptr;
72 
73  if (opsys == ObjectFile::UnknownOpSys) {
74  warn("Unknown operating system; assuming Linux.");
75  opsys = ObjectFile::Linux;
76  }
77 
78  if (opsys != ObjectFile::Linux)
79  return nullptr;
80 
81  if (arch == ObjectFile::X86_64)
82  return new X86_64LinuxProcess(params, obj_file);
83  else
84  return new I386LinuxProcess(params, obj_file);
85  }
86 };
87 
88 X86LinuxObjectFileLoader loader;
89 
90 } // anonymous namespace
91 
93 static SyscallReturn
94 unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
95 {
96  int index = 0;
97  auto process = tc->getProcessPtr();
98  TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index));
99 
100  strcpy(name->sysname, "Linux");
101  strcpy(name->nodename, "sim.gem5.org");
102  strcpy(name->release, process->release.c_str());
103  strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003");
104  strcpy(name->machine, "x86_64");
105 
106  name.copyOut(tc->getVirtProxy());
107 
108  return 0;
109 }
110 
111 static SyscallReturn
112 archPrctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
113 {
114  enum ArchPrctlCodes
115  {
116  SetFS = 0x1002,
117  GetFS = 0x1003,
118  SetGS = 0x1001,
119  GetGS = 0x1004
120  };
121 
122  // First argument is the code, second is the address
123  int index = 0;
124  auto process = tc->getProcessPtr();
125  int code = process->getSyscallArg(tc, index);
126  uint64_t addr = process->getSyscallArg(tc, index);
127  uint64_t fsBase, gsBase;
128  PortProxy &p = tc->getVirtProxy();
129  switch(code)
130  {
131  // Each of these valid options should actually check addr.
132  case SetFS:
135  return 0;
136  case GetFS:
137  fsBase = tc->readMiscRegNoEffect(MISCREG_FS_BASE);
138  p.write(addr, fsBase);
139  return 0;
140  case SetGS:
143  return 0;
144  case GetGS:
145  gsBase = tc->readMiscRegNoEffect(MISCREG_GS_BASE);
146  p.write(addr, gsBase);
147  return 0;
148  default:
149  return -EINVAL;
150  }
151 }
152 
153 BitUnion32(UserDescFlags)
154  Bitfield<0> seg_32bit;
155  Bitfield<2, 1> contents;
156  Bitfield<3> read_exec_only;
157  Bitfield<4> limit_in_pages;
158  Bitfield<5> seg_not_present;
159  Bitfield<6> useable;
160 EndBitUnion(UserDescFlags)
161 
162 struct UserDesc32 {
163  uint32_t entry_number;
164  uint32_t base_addr;
165  uint32_t limit;
166  uint32_t flags;
167 };
168 
169 struct UserDesc64 {
170  uint32_t entry_number;
171  uint32_t __padding1;
172  uint64_t base_addr;
173  uint32_t limit;
174  uint32_t flags;
175 };
176 
177 static SyscallReturn
179 {
180  const int minTLSEntry = 6;
181  const int numTLSEntries = 3;
182  const int maxTLSEntry = minTLSEntry + numTLSEntries - 1;
183 
184  auto process = tc->getProcessPtr();
185 
186  X86Process *x86p = dynamic_cast<X86Process *>(process);
187  assert(x86p);
188 
189  assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize());
190 
191  int argIndex = 0;
192  TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex));
194  gdt(x86p->gdtStart() + minTLSEntry * sizeof(uint64_t),
195  numTLSEntries * sizeof(uint64_t));
196 
197  if (!userDesc.copyIn(tc->getVirtProxy()))
198  return -EFAULT;
199 
200  if (!gdt.copyIn(tc->getVirtProxy()))
201  panic("Failed to copy in GDT for %s.\n", desc->name());
202 
203  if (userDesc->entry_number == (uint32_t)(-1)) {
204  // Find a free TLS entry.
205  for (int i = 0; i < numTLSEntries; i++) {
206  if (gdt[i] == 0) {
207  userDesc->entry_number = i + minTLSEntry;
208  break;
209  }
210  }
211  // We failed to find one.
212  if (userDesc->entry_number == (uint32_t)(-1))
213  return -ESRCH;
214  }
215 
216  int index = userDesc->entry_number;
217 
218  if (index < minTLSEntry || index > maxTLSEntry)
219  return -EINVAL;
220 
221  index -= minTLSEntry;
222 
223  // Build the entry we're going to add.
224  SegDescriptor segDesc = 0;
225  UserDescFlags flags = userDesc->flags;
226 
227  segDesc.limitLow = bits(userDesc->limit, 15, 0);
228  segDesc.baseLow = bits(userDesc->base_addr, 23, 0);
229  segDesc.type.a = 1;
230  if (!flags.read_exec_only)
231  segDesc.type.w = 1;
232  if (bits((uint8_t)flags.contents, 0))
233  segDesc.type.e = 1;
234  if (bits((uint8_t)flags.contents, 1))
235  segDesc.type.codeOrData = 1;
236  segDesc.s = 1;
237  segDesc.dpl = 3;
238  if (!flags.seg_not_present)
239  segDesc.p = 1;
240  segDesc.limitHigh = bits(userDesc->limit, 19, 16);
241  if (flags.useable)
242  segDesc.avl = 1;
243  segDesc.l = 0;
244  if (flags.seg_32bit)
245  segDesc.d = 1;
246  if (flags.limit_in_pages)
247  segDesc.g = 1;
248  segDesc.baseHigh = bits(userDesc->base_addr, 31, 24);
249 
250  gdt[index] = (uint64_t)segDesc;
251 
252  if (!userDesc.copyOut(tc->getVirtProxy()))
253  return -EFAULT;
254  if (!gdt.copyOut(tc->getVirtProxy()))
255  panic("Failed to copy out GDT for %s.\n", desc->name());
256 
257  return 0;
258 }
259 
261  /* 0 */ { "read", readFunc<X86Linux64> },
262  /* 1 */ { "write", writeFunc<X86Linux64> },
263  /* 2 */ { "open", openFunc<X86Linux64> },
264  /* 3 */ { "close", closeFunc },
265  /* 4 */ { "stat", stat64Func<X86Linux64> },
266  /* 5 */ { "fstat", fstat64Func<X86Linux64> },
267  /* 6 */ { "lstat", lstat64Func<X86Linux64> },
268  /* 7 */ { "poll", pollFunc<X86Linux64> },
269  /* 8 */ { "lseek", lseekFunc },
270  /* 9 */ { "mmap", mmapFunc<X86Linux64> },
271  /* 10 */ { "mprotect", ignoreFunc },
272  /* 11 */ { "munmap", munmapFunc },
273  /* 12 */ { "brk", brkFunc },
274  /* 13 */ { "rt_sigaction", ignoreWarnOnceFunc },
275  /* 14 */ { "rt_sigprocmask", ignoreWarnOnceFunc },
276  /* 15 */ { "rt_sigreturn" },
277  /* 16 */ { "ioctl", ioctlFunc<X86Linux64> },
278  /* 17 */ { "pread64" },
279  /* 18 */ { "pwrite64", pwrite64Func<X86Linux64> },
280  /* 19 */ { "readv", readvFunc<X86Linux64> },
281  /* 20 */ { "writev", writevFunc<X86Linux64> },
282  /* 21 */ { "access", ignoreFunc },
283  /* 22 */ { "pipe", pipeFunc },
284  /* 23 */ { "select", selectFunc<X86Linux64> },
285  /* 24 */ { "sched_yield", ignoreFunc },
286  /* 25 */ { "mremap", mremapFunc<X86Linux64> },
287  /* 26 */ { "msync" },
288  /* 27 */ { "mincore" },
289  /* 28 */ { "madvise", ignoreFunc },
290  /* 29 */ { "shmget" },
291  /* 30 */ { "shmat" },
292  /* 31 */ { "shmctl" },
293  /* 32 */ { "dup", dupFunc },
294  /* 33 */ { "dup2", dup2Func },
295  /* 34 */ { "pause" },
296  /* 35 */ { "nanosleep", ignoreWarnOnceFunc },
297  /* 36 */ { "getitimer" },
298  /* 37 */ { "alarm" },
299  /* 38 */ { "setitimer" },
300  /* 39 */ { "getpid", getpidFunc },
301  /* 40 */ { "sendfile" },
302  /* 41 */ { "socket", socketFunc<X86Linux64> },
303  /* 42 */ { "connect", connectFunc },
304  /* 43 */ { "accept", acceptFunc<X86Linux64> },
305  /* 44 */ { "sendto", sendtoFunc },
306  /* 45 */ { "recvfrom", recvfromFunc },
307  /* 46 */ { "sendmsg", sendmsgFunc },
308  /* 47 */ { "recvmsg", recvmsgFunc },
309  /* 48 */ { "shutdown", shutdownFunc },
310  /* 49 */ { "bind", bindFunc },
311  /* 50 */ { "listen", listenFunc },
312  /* 51 */ { "getsockname", getsocknameFunc },
313  /* 52 */ { "getpeername", getpeernameFunc },
314  /* 53 */ { "socketpair", socketpairFunc<X86Linux64> },
315  /* 54 */ { "setsockopt", setsockoptFunc },
316  /* 55 */ { "getsockopt", getsockoptFunc },
317  /* 56 */ { "clone", cloneFunc<X86Linux64> },
318  /* 57 */ { "fork" },
319  /* 58 */ { "vfork" },
320  /* 59 */ { "execve", execveFunc<X86Linux64> },
321  /* 60 */ { "exit", exitFunc },
322  /* 61 */ { "wait4", wait4Func<X86Linux64> },
323  /* 62 */ { "kill" },
324  /* 63 */ { "uname", unameFunc },
325  /* 64 */ { "semget" },
326  /* 65 */ { "semop" },
327  /* 66 */ { "semctl" },
328  /* 67 */ { "shmdt" },
329  /* 68 */ { "msgget" },
330  /* 69 */ { "msgsnd" },
331  /* 70 */ { "msgrcv" },
332  /* 71 */ { "msgctl" },
333  /* 72 */ { "fcntl", fcntlFunc },
334  /* 73 */ { "flock" },
335  /* 74 */ { "fsync" },
336  /* 75 */ { "fdatasync" },
337  /* 76 */ { "truncate", truncateFunc },
338  /* 77 */ { "ftruncate", ftruncateFunc },
339 #if defined(SYS_getdents)
340  /* 78 */ { "getdents", getdentsFunc },
341 #else
342  /* 78 */ { "getdents" },
343 #endif
344  /* 79 */ { "getcwd", getcwdFunc },
345  /* 80 */ { "chdir", chdirFunc },
346  /* 81 */ { "fchdir" },
347  /* 82 */ { "rename", renameFunc },
348  /* 83 */ { "mkdir", mkdirFunc },
349  /* 84 */ { "rmdir", rmdirFunc },
350  /* 85 */ { "creat" },
351  /* 86 */ { "link", linkFunc },
352  /* 87 */ { "unlink", unlinkFunc },
353  /* 88 */ { "symlink", symlinkFunc },
354  /* 89 */ { "readlink", readlinkFunc },
355  /* 90 */ { "chmod" },
356  /* 91 */ { "fchmod" },
357  /* 92 */ { "chown" },
358  /* 93 */ { "fchown" },
359  /* 94 */ { "lchown" },
360  /* 95 */ { "umask", umaskFunc },
361  /* 96 */ { "gettimeofday", gettimeofdayFunc<X86Linux64> },
362  /* 97 */ { "getrlimit", getrlimitFunc<X86Linux64> },
363  /* 98 */ { "getrusage", getrusageFunc<X86Linux64> },
364  /* 99 */ { "sysinfo", sysinfoFunc<X86Linux64> },
365  /* 100 */ { "times", timesFunc<X86Linux64> },
366  /* 101 */ { "ptrace" },
367  /* 102 */ { "getuid", getuidFunc },
368  /* 103 */ { "syslog" },
369  /* 104 */ { "getgid", getgidFunc },
370  /* 105 */ { "setuid" },
371  /* 106 */ { "setgid" },
372  /* 107 */ { "geteuid", geteuidFunc },
373  /* 108 */ { "getegid", getegidFunc },
374  /* 109 */ { "setpgid", setpgidFunc },
375  /* 110 */ { "getppid", getppidFunc },
376  /* 111 */ { "getpgrp", getpgrpFunc },
377  /* 112 */ { "setsid" },
378  /* 113 */ { "setreuid" },
379  /* 114 */ { "setregid" },
380  /* 115 */ { "getgroups" },
381  /* 116 */ { "setgroups" },
382  /* 117 */ { "setresuid", ignoreFunc },
383  /* 118 */ { "getresuid" },
384  /* 119 */ { "setresgid" },
385  /* 120 */ { "getresgid" },
386  /* 121 */ { "getpgid" },
387  /* 122 */ { "setfsuid" },
388  /* 123 */ { "setfsgid" },
389  /* 124 */ { "getsid" },
390  /* 125 */ { "capget" },
391  /* 126 */ { "capset" },
392  /* 127 */ { "rt_sigpending" },
393  /* 128 */ { "rt_sigtimedwait" },
394  /* 129 */ { "rt_sigqueueinfo" },
395  /* 130 */ { "rt_sigsuspend" },
396  /* 131 */ { "sigaltstack" },
397  /* 132 */ { "utime" },
398  /* 133 */ { "mknod", mknodFunc },
399  /* 134 */ { "uselib" },
400  /* 135 */ { "personality" },
401  /* 136 */ { "ustat" },
402  /* 137 */ { "statfs", statfsFunc<X86Linux64> },
403  /* 138 */ { "fstatfs", fstatfsFunc<X86Linux64> },
404  /* 139 */ { "sysfs" },
405  /* 140 */ { "getpriority" },
406  /* 141 */ { "setpriority", ignoreFunc },
407  /* 142 */ { "sched_setparam" },
408  /* 143 */ { "sched_getparam" },
409  /* 144 */ { "sched_setscheduler" },
410  /* 145 */ { "sched_getscheduler" },
411  /* 146 */ { "sched_get_priority_max" },
412  /* 147 */ { "sched_get_priority_min" },
413  /* 148 */ { "sched_rr_get_interval" },
414  /* 149 */ { "mlock" },
415  /* 150 */ { "munlock" },
416  /* 151 */ { "mlockall" },
417  /* 152 */ { "munlockall" },
418  /* 153 */ { "vhangup" },
419  /* 154 */ { "modify_ldt" },
420  /* 155 */ { "pivot_root" },
421  /* 156 */ { "_sysctl" },
422  /* 157 */ { "prctl" },
423  /* 158 */ { "arch_prctl", archPrctlFunc },
424  /* 159 */ { "adjtimex" },
425  /* 160 */ { "setrlimit", ignoreFunc },
426  /* 161 */ { "chroot" },
427  /* 162 */ { "sync" },
428  /* 163 */ { "acct" },
429  /* 164 */ { "settimeofday" },
430  /* 165 */ { "mount" },
431  /* 166 */ { "umount2" },
432  /* 167 */ { "swapon" },
433  /* 168 */ { "swapoff" },
434  /* 169 */ { "reboot" },
435  /* 170 */ { "sethostname" },
436  /* 171 */ { "setdomainname" },
437  /* 172 */ { "iopl" },
438  /* 173 */ { "ioperm" },
439  /* 174 */ { "create_module" },
440  /* 175 */ { "init_module" },
441  /* 176 */ { "delete_module" },
442  /* 177 */ { "get_kernel_syms" },
443  /* 178 */ { "query_module" },
444  /* 179 */ { "quotactl" },
445  /* 180 */ { "nfsservctl" },
446  /* 181 */ { "getpmsg" },
447  /* 182 */ { "putpmsg" },
448  /* 183 */ { "afs_syscall" },
449  /* 184 */ { "tuxcall" },
450  /* 185 */ { "security" },
451  /* 186 */ { "gettid", gettidFunc },
452  /* 187 */ { "readahead" },
453  /* 188 */ { "setxattr" },
454  /* 189 */ { "lsetxattr" },
455  /* 190 */ { "fsetxattr" },
456  /* 191 */ { "getxattr" },
457  /* 192 */ { "lgetxattr" },
458  /* 193 */ { "fgetxattr" },
459  /* 194 */ { "listxattr" },
460  /* 195 */ { "llistxattr" },
461  /* 196 */ { "flistxattr" },
462  /* 197 */ { "removexattr" },
463  /* 198 */ { "lremovexattr" },
464  /* 199 */ { "fremovexattr" },
465  /* 200 */ { "tkill" },
466  /* 201 */ { "time", timeFunc<X86Linux64> },
467  /* 202 */ { "futex", futexFunc<X86Linux64> },
468  /* 203 */ { "sched_setaffinity" },
469  /* 204 */ { "sched_getaffinity", ignoreFunc },
470  /* 205 */ { "set_thread_area" },
471  /* 206 */ { "io_setup" },
472  /* 207 */ { "io_destroy" },
473  /* 208 */ { "io_getevents" },
474  /* 209 */ { "io_submit" },
475  /* 210 */ { "io_cancel" },
476  /* 211 */ { "get_thread_area" },
477  /* 212 */ { "lookup_dcookie" },
478  /* 213 */ { "epoll_create" },
479  /* 214 */ { "epoll_ctl_old" },
480  /* 215 */ { "epoll_wait_old" },
481  /* 216 */ { "remap_file_pages" },
482  /* 217 */ { "getdents64" },
483  /* 218 */ { "set_tid_address", setTidAddressFunc },
484  /* 219 */ { "restart_syscall" },
485  /* 220 */ { "semtimedop" },
486  /* 221 */ { "fadvise64", ignoreFunc },
487  /* 222 */ { "timer_create" },
488  /* 223 */ { "timer_settime" },
489  /* 224 */ { "timer_gettime" },
490  /* 225 */ { "timer_getoverrun" },
491  /* 226 */ { "timer_delete" },
492  /* 227 */ { "clock_settime" },
493  /* 228 */ { "clock_gettime", clock_gettimeFunc<X86Linux64> },
494  /* 229 */ { "clock_getres", clock_getresFunc<X86Linux64> },
495  /* 230 */ { "clock_nanosleep" },
496  /* 231 */ { "exit_group", exitGroupFunc },
497  /* 232 */ { "epoll_wait" },
498  /* 233 */ { "epoll_ctl" },
499  /* 234 */ { "tgkill", tgkillFunc<X86Linux64> },
500  /* 235 */ { "utimes" },
501  /* 236 */ { "vserver" },
502  /* 237 */ { "mbind" },
503  /* 238 */ { "set_mempolicy" },
504  /* 239 */ { "get_mempolicy", ignoreFunc },
505  /* 240 */ { "mq_open" },
506  /* 241 */ { "mq_unlink" },
507  /* 242 */ { "mq_timedsend" },
508  /* 243 */ { "mq_timedreceive" },
509  /* 244 */ { "mq_notify" },
510  /* 245 */ { "mq_getsetattr" },
511  /* 246 */ { "kexec_load" },
512  /* 247 */ { "waitid" },
513  /* 248 */ { "add_key" },
514  /* 249 */ { "request_key" },
515  /* 250 */ { "keyctl" },
516  /* 251 */ { "ioprio_set" },
517  /* 252 */ { "ioprio_get" },
518  /* 253 */ { "inotify_init" },
519  /* 254 */ { "inotify_add_watch" },
520  /* 255 */ { "inotify_rm_watch" },
521  /* 256 */ { "migrate_pages" },
522  /* 257 */ { "openat", openatFunc<X86Linux64> },
523  /* 258 */ { "mkdirat" },
524  /* 259 */ { "mknodat" },
525  /* 260 */ { "fchownat" },
526  /* 261 */ { "futimesat" },
527  /* 262 */ { "newfstatat" },
528  /* 263 */ { "unlinkat" },
529  /* 264 */ { "renameat" },
530  /* 265 */ { "linkat" },
531  /* 266 */ { "symlinkat" },
532  /* 267 */ { "readlinkat", readlinkFunc },
533  /* 268 */ { "fchmodat" },
534  /* 269 */ { "faccessat" },
535  /* 270 */ { "pselect6" },
536  /* 271 */ { "ppoll" },
537  /* 272 */ { "unshare" },
538  /* 273 */ { "set_robust_list", ignoreFunc },
539  /* 274 */ { "get_robust_list" },
540  /* 275 */ { "splice" },
541  /* 276 */ { "tee" },
542  /* 277 */ { "sync_file_range" },
543  /* 278 */ { "vmsplice" },
544  /* 279 */ { "move_pages" },
545  /* 280 */ { "utimensat" },
546  /* 281 */ { "epoll_pwait" },
547  /* 282 */ { "signalfd" },
548  /* 283 */ { "timerfd_create" },
549  /* 284 */ { "eventfd", eventfdFunc<X86Linux64> },
550  /* 285 */ { "fallocate", fallocateFunc },
551  /* 286 */ { "timerfd_settime" },
552  /* 287 */ { "timerfd_gettime" },
553  /* 288 */ { "accept4" },
554  /* 289 */ { "signalfd4" },
555  /* 290 */ { "eventfd2", eventfdFunc<X86Linux64> },
556  /* 291 */ { "epoll_create1" },
557  /* 292 */ { "dup3" },
558  /* 293 */ { "pipe2", pipe2Func },
559  /* 294 */ { "inotify_init1" },
560  /* 295 */ { "preadv" },
561  /* 296 */ { "pwritev" },
562  /* 297 */ { "rt_tgsigqueueinfo" },
563  /* 298 */ { "perf_event_open" },
564  /* 299 */ { "recvmmsg" },
565  /* 300 */ { "fanotify_init" },
566  /* 301 */ { "fanotify_mark" },
567  /* 302 */ { "prlimit64", prlimitFunc<X86Linux64> },
568  /* 303 */ { "name_to_handle_at" },
569  /* 304 */ { "open_by_handle_at" },
570  /* 305 */ { "clock_adjtime" },
571  /* 306 */ { "syncfs" },
572  /* 307 */ { "sendmmsg" },
573  /* 308 */ { "setns" },
574  /* 309 */ { "getcpu" },
575  /* 310 */ { "proess_vm_readv" },
576  /* 311 */ { "proess_vm_writev" },
577  /* 312 */ { "kcmp" },
578  /* 313 */ { "finit_module" },
579 };
580 
581 X86_64LinuxProcess::X86_64LinuxProcess(ProcessParams * params,
582  ObjectFile *objFile)
583  : X86_64Process(params, objFile, syscallDescs64,
584  sizeof(syscallDescs64) / sizeof(SyscallDesc))
585 {}
586 
587 void
589 {
590  doSyscall(tc->readIntReg(INTREG_RAX), tc, fault);
591 }
592 
593 void
595  Process *process, RegVal flags)
596 {
597  X86_64Process::clone(old_tc, new_tc, (X86_64Process*)process, flags);
598 }
599 
601  /* 0 */ { "restart_syscall" },
602  /* 1 */ { "exit", exitFunc },
603  /* 2 */ { "fork" },
604  /* 3 */ { "read", readFunc<X86Linux32> },
605  /* 4 */ { "write", writeFunc<X86Linux32> },
606  /* 5 */ { "open", openFunc<X86Linux32> },
607  /* 6 */ { "close", closeFunc },
608  /* 7 */ { "waitpid" },
609  /* 8 */ { "creat" },
610  /* 9 */ { "link" },
611  /* 10 */ { "unlink" },
612  /* 11 */ { "execve", execveFunc<X86Linux32> },
613  /* 12 */ { "chdir", chdirFunc },
614  /* 13 */ { "time", timeFunc<X86Linux32> },
615  /* 14 */ { "mknod", mknodFunc },
616  /* 15 */ { "chmod" },
617  /* 16 */ { "lchown" },
618  /* 17 */ { "break" },
619  /* 18 */ { "oldstat" },
620  /* 19 */ { "lseek" },
621  /* 20 */ { "getpid", getpidFunc },
622  /* 21 */ { "mount" },
623  /* 22 */ { "umount" },
624  /* 23 */ { "setuid" },
625  /* 24 */ { "getuid", getuidFunc },
626  /* 25 */ { "stime" },
627  /* 26 */ { "ptrace" },
628  /* 27 */ { "alarm" },
629  /* 28 */ { "oldfstat" },
630  /* 29 */ { "pause" },
631  /* 30 */ { "utime" },
632  /* 31 */ { "stty" },
633  /* 32 */ { "gtty" },
634  /* 33 */ { "access", ignoreFunc },
635  /* 34 */ { "nice" },
636  /* 35 */ { "ftime" },
637  /* 36 */ { "sync" },
638  /* 37 */ { "kill" },
639  /* 38 */ { "rename" },
640  /* 39 */ { "mkdir", mkdirFunc },
641  /* 40 */ { "rmdir", mkdirFunc },
642  /* 41 */ { "dup", dupFunc },
643  /* 42 */ { "pipe", pipeFunc },
644  /* 43 */ { "times", timesFunc<X86Linux32> },
645  /* 44 */ { "prof" },
646  /* 45 */ { "brk", brkFunc },
647  /* 46 */ { "setgid" },
648  /* 47 */ { "getgid", getgidFunc },
649  /* 48 */ { "signal" },
650  /* 49 */ { "geteuid", geteuidFunc },
651  /* 50 */ { "getegid", getegidFunc },
652  /* 51 */ { "acct" },
653  /* 52 */ { "umount2" },
654  /* 53 */ { "lock" },
655  /* 54 */ { "ioctl", ioctlFunc<X86Linux32> },
656  /* 55 */ { "fcntl", fcntlFunc },
657  /* 56 */ { "mpx" },
658  /* 57 */ { "setpgid", setpgidFunc },
659  /* 58 */ { "ulimit" },
660  /* 59 */ { "oldolduname" },
661  /* 60 */ { "umask", umaskFunc },
662  /* 61 */ { "chroot" },
663  /* 62 */ { "ustat" },
664  /* 63 */ { "dup2", dup2Func },
665  /* 64 */ { "getppid" },
666  /* 65 */ { "getpgrp" },
667  /* 66 */ { "setsid" },
668  /* 67 */ { "sigaction" },
669  /* 68 */ { "sgetmask" },
670  /* 69 */ { "ssetmask" },
671  /* 70 */ { "setreuid" },
672  /* 71 */ { "setregid" },
673  /* 72 */ { "sigsuspend" },
674  /* 73 */ { "sigpending" },
675  /* 74 */ { "sethostname" },
676  /* 75 */ { "setrlimit", ignoreFunc },
677  /* 76 */ { "getrlimit", getrlimitFunc<X86Linux32> },
678  /* 77 */ { "getrusage", getrusageFunc<X86Linux32> },
679  /* 78 */ { "gettimeofday" },
680  /* 79 */ { "settimeofday" },
681  /* 80 */ { "getgroups" },
682  /* 81 */ { "setgroups" },
683  /* 82 */ { "select", selectFunc<X86Linux32> },
684  /* 83 */ { "symlink" },
685  /* 84 */ { "oldlstat" },
686  /* 85 */ { "readlink", readlinkFunc },
687  /* 86 */ { "uselib" },
688  /* 87 */ { "swapon" },
689  /* 88 */ { "reboot" },
690  /* 89 */ { "readdir" },
691  /* 90 */ { "mmap" },
692  /* 91 */ { "munmap", munmapFunc },
693  /* 92 */ { "truncate", truncateFunc },
694  /* 93 */ { "ftruncate", ftruncateFunc },
695  /* 94 */ { "fchmod" },
696  /* 95 */ { "fchown" },
697  /* 96 */ { "getpriority" },
698  /* 97 */ { "setpriority", ignoreFunc },
699  /* 98 */ { "profil" },
700  /* 99 */ { "statfs", ignoreFunc },
701  /* 100 */ { "fstatfs" },
702  /* 101 */ { "ioperm" },
703  /* 102 */ { "socketcall" },
704  /* 103 */ { "syslog" },
705  /* 104 */ { "setitimer" },
706  /* 105 */ { "getitimer" },
707  /* 106 */ { "stat" },
708  /* 107 */ { "lstat" },
709  /* 108 */ { "fstat" },
710  /* 109 */ { "olduname" },
711  /* 110 */ { "iopl" },
712  /* 111 */ { "vhangup" },
713  /* 112 */ { "idle" },
714  /* 113 */ { "vm86old" },
715  /* 114 */ { "wait4", wait4Func<X86Linux32> },
716  /* 115 */ { "swapoff" },
717  /* 116 */ { "sysinfo", sysinfoFunc<X86Linux32> },
718  /* 117 */ { "ipc" },
719  /* 118 */ { "fsync" },
720  /* 119 */ { "sigreturn" },
721  /* 120 */ { "clone", cloneFunc<X86Linux32> },
722  /* 121 */ { "setdomainname" },
723  /* 122 */ { "uname", unameFunc },
724  /* 123 */ { "modify_ldt" },
725  /* 124 */ { "adjtimex" },
726  /* 125 */ { "mprotect", ignoreFunc },
727  /* 126 */ { "sigprocmask" },
728  /* 127 */ { "create_module" },
729  /* 128 */ { "init_module" },
730  /* 129 */ { "delete_module" },
731  /* 130 */ { "get_kernel_syms" },
732  /* 131 */ { "quotactl" },
733  /* 132 */ { "getpgid" },
734  /* 133 */ { "fchdir" },
735  /* 134 */ { "bdflush" },
736  /* 135 */ { "sysfs" },
737  /* 136 */ { "personality" },
738  /* 137 */ { "afs_syscall" },
739  /* 138 */ { "setfsuid" },
740  /* 139 */ { "setfsgid" },
741  /* 140 */ { "_llseek", _llseekFunc },
742 #if defined(SYS_getdents)
743  /* 141 */ { "getdents", getdentsFunc },
744 #else
745  /* 141 */ { "getdents" },
746 #endif
747  /* 142 */ { "_newselect" },
748  /* 143 */ { "flock" },
749  /* 144 */ { "msync" },
750  /* 145 */ { "readv", readvFunc<X86Linux32> },
751  /* 146 */ { "writev", writevFunc<X86Linux32> },
752  /* 147 */ { "getsid" },
753  /* 148 */ { "fdatasync" },
754  /* 149 */ { "_sysctl" },
755  /* 150 */ { "mlock" },
756  /* 151 */ { "munlock" },
757  /* 152 */ { "mlockall" },
758  /* 153 */ { "munlockall" },
759  /* 154 */ { "sched_setparam" },
760  /* 155 */ { "sched_getparam" },
761  /* 156 */ { "sched_setscheduler" },
762  /* 157 */ { "sched_getscheduler" },
763  /* 158 */ { "sched_yield", ignoreFunc },
764  /* 159 */ { "sched_get_priority_max" },
765  /* 160 */ { "sched_get_priority_min" },
766  /* 161 */ { "sched_rr_get_interval" },
767  /* 162 */ { "nanosleep", ignoreFunc },
768  /* 163 */ { "mremap" },
769  /* 164 */ { "setresuid", ignoreFunc },
770  /* 165 */ { "getresuid" },
771  /* 166 */ { "vm86" },
772  /* 167 */ { "query_module" },
773  /* 168 */ { "poll", pollFunc<X86Linux32> },
774  /* 169 */ { "nfsservctl" },
775  /* 170 */ { "setresgid" },
776  /* 171 */ { "getresgid" },
777  /* 172 */ { "prctl" },
778  /* 173 */ { "rt_sigreturn" },
779  /* 174 */ { "rt_sigaction", ignoreFunc },
780  /* 175 */ { "rt_sigprocmask", ignoreFunc },
781  /* 176 */ { "rt_sigpending" },
782  /* 177 */ { "rt_sigtimedwait" },
783  /* 178 */ { "rt_sigqueueinfo" },
784  /* 179 */ { "rt_sigsuspend" },
785  /* 180 */ { "pread64" },
786  /* 181 */ { "pwrite64" },
787  /* 182 */ { "chown" },
788  /* 183 */ { "getcwd", getcwdFunc },
789  /* 184 */ { "capget" },
790  /* 185 */ { "capset" },
791  /* 186 */ { "sigaltstack" },
792  /* 187 */ { "sendfile" },
793  /* 188 */ { "getpmsg" },
794  /* 189 */ { "putpmsg" },
795  /* 190 */ { "vfork" },
796  /* 191 */ { "ugetrlimit", ignoreFunc },
797  /* 192 */ { "mmap2", mmap2Func<X86Linux32> },
798  /* 193 */ { "truncate64", truncate64Func },
799  /* 194 */ { "ftruncate64", ftruncate64Func },
800  /* 195 */ { "stat64", stat64Func<X86Linux32> },
801  /* 196 */ { "lstat64" },
802  /* 197 */ { "fstat64", fstat64Func<X86Linux32> },
803  /* 198 */ { "lchown32" },
804  /* 199 */ { "getuid32", getuidFunc },
805  /* 200 */ { "getgid32", getgidFunc },
806  /* 201 */ { "geteuid32", geteuidFunc },
807  /* 202 */ { "getegid32", getegidFunc },
808  /* 203 */ { "setreuid32" },
809  /* 204 */ { "setregid32" },
810  /* 205 */ { "getgroups32" },
811  /* 206 */ { "setgroups32" },
812  /* 207 */ { "fchown32" },
813  /* 208 */ { "setresuid32" },
814  /* 209 */ { "getresuid32" },
815  /* 210 */ { "setresgid32" },
816  /* 211 */ { "getresgid32" },
817  /* 212 */ { "chown32" },
818  /* 213 */ { "setuid32" },
819  /* 214 */ { "setgid32" },
820  /* 215 */ { "setfsuid32" },
821  /* 216 */ { "setfsgid32" },
822  /* 217 */ { "pivot_root" },
823  /* 218 */ { "mincore" },
824  /* 219 */ { "madvise", ignoreFunc },
825  /* 220 */ { "madvise1" },
826  /* 221 */ { "getdents64" },
827  /* 222 */ { "fcntl64" },
828  /* 223 */ { "unused" },
829  /* 224 */ { "gettid", gettidFunc },
830  /* 225 */ { "readahead" },
831  /* 226 */ { "setxattr" },
832  /* 227 */ { "lsetxattr" },
833  /* 228 */ { "fsetxattr" },
834  /* 229 */ { "getxattr" },
835  /* 230 */ { "lgetxattr" },
836  /* 231 */ { "fgetxattr" },
837  /* 232 */ { "listxattr" },
838  /* 233 */ { "llistxattr" },
839  /* 234 */ { "flistxattr" },
840  /* 235 */ { "removexattr" },
841  /* 236 */ { "lremovexattr" },
842  /* 237 */ { "fremovexattr" },
843  /* 238 */ { "tkill" },
844  /* 239 */ { "sendfile64" },
845  /* 240 */ { "futex" },
846  /* 241 */ { "sched_setaffinity" },
847  /* 242 */ { "sched_getaffinity", ignoreFunc },
848  /* 243 */ { "set_thread_area", setThreadArea32Func },
849  /* 244 */ { "get_thread_area" },
850  /* 245 */ { "io_setup" },
851  /* 246 */ { "io_destroy" },
852  /* 247 */ { "io_getevents" },
853  /* 248 */ { "io_submit" },
854  /* 249 */ { "io_cancel" },
855  /* 250 */ { "fadvise64" },
856  /* 251 */ { "unused" },
857  /* 252 */ { "exit_group", exitFunc },
858  /* 253 */ { "lookup_dcookie" },
859  /* 254 */ { "epoll_create" },
860  /* 255 */ { "epoll_ctl" },
861  /* 256 */ { "epoll_wait" },
862  /* 257 */ { "remap_file_pages" },
863  /* 258 */ { "set_tid_address", setTidAddressFunc },
864  /* 259 */ { "timer_create" },
865  /* 260 */ { "timer_settime" },
866  /* 261 */ { "timer_gettime" },
867  /* 262 */ { "timer_getoverrun" },
868  /* 263 */ { "timer_delete" },
869  /* 264 */ { "clock_settime" },
870  /* 265 */ { "clock_gettime", clock_gettimeFunc<X86Linux32> },
871  /* 266 */ { "clock_getres" },
872  /* 267 */ { "clock_nanosleep" },
873  /* 268 */ { "statfs64" },
874  /* 269 */ { "fstatfs64" },
875  /* 270 */ { "tgkill", tgkillFunc<X86Linux32> },
876  /* 271 */ { "utimes" },
877  /* 272 */ { "fadvise64_64" },
878  /* 273 */ { "vserver" },
879  /* 274 */ { "mbind" },
880  /* 275 */ { "get_mempolicy", ignoreFunc },
881  /* 276 */ { "set_mempolicy" },
882  /* 277 */ { "mq_open" },
883  /* 278 */ { "mq_unlink" },
884  /* 279 */ { "mq_timedsend" },
885  /* 280 */ { "mq_timedreceive" },
886  /* 281 */ { "mq_notify" },
887  /* 282 */ { "mq_getsetattr" },
888  /* 283 */ { "kexec_load" },
889  /* 284 */ { "waitid" },
890  /* 285 */ { "sys_setaltroot" },
891  /* 286 */ { "add_key" },
892  /* 287 */ { "request_key" },
893  /* 288 */ { "keyctl" },
894  /* 289 */ { "ioprio_set" },
895  /* 290 */ { "ioprio_get" },
896  /* 291 */ { "inotify_init" },
897  /* 292 */ { "inotify_add_watch" },
898  /* 293 */ { "inotify_rm_watch" },
899  /* 294 */ { "migrate_pages" },
900  /* 295 */ { "openat", openatFunc<X86Linux32> },
901  /* 296 */ { "mkdirat" },
902  /* 297 */ { "mknodat" },
903  /* 298 */ { "fchownat" },
904  /* 299 */ { "futimesat" },
905  /* 300 */ { "fstatat64" },
906  /* 301 */ { "unlinkat" },
907  /* 302 */ { "renameat" },
908  /* 303 */ { "linkat" },
909  /* 304 */ { "symlinkat" },
910  /* 305 */ { "readlinkat", readlinkFunc },
911  /* 306 */ { "fchmodat" },
912  /* 307 */ { "faccessat" },
913  /* 308 */ { "pselect6" },
914  /* 309 */ { "ppoll" },
915  /* 310 */ { "unshare" },
916  /* 311 */ { "set_robust_list", ignoreFunc },
917  /* 312 */ { "get_robust_list", ignoreFunc },
918  /* 313 */ { "splice" },
919  /* 314 */ { "sync_file_range" },
920  /* 315 */ { "tee" },
921  /* 316 */ { "vmsplice" },
922  /* 317 */ { "move_pages" },
923  /* 318 */ { "getcpu" },
924  /* 319 */ { "epoll_pwait" },
925  /* 320 */ { "utimensat" },
926  /* 321 */ { "signalfd" },
927  /* 322 */ { "timerfd" },
928  /* 323 */ { "eventfd", eventfdFunc<X86Linux32> }
929 };
930 
932  : I386Process(params, objFile, syscallDescs32,
933  sizeof(syscallDescs32) / sizeof(SyscallDesc))
934 {}
935 
936 void
938 {
939  PCState pc = tc->pcState();
940  Addr eip = pc.pc();
941  if (eip >= vsyscallPage.base &&
944  tc->pcState(pc);
945  }
946  doSyscall(tc->readIntReg(INTREG_RAX), tc, fault);
947 }
948 
949 void
951  Process *process, RegVal flags)
952 {
953  I386Process::clone(old_tc, new_tc, (I386Process*)process, flags);
954 }
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:167
VSyscallPage vsyscallPage
Definition: process.hh:173
ObjectFile * objFile
Definition: process.hh:217
Bitfield< 30, 0 > index
uint32_t entry_number
Definition: process.cc:170
Arch getArch() const
Definition: object_file.hh:124
const std::string & name()
Definition: trace.cc:54
EndBitUnion(UserDescFlags) struct UserDesc32
Definition: process.cc:160
Bitfield< 7 > i
SyscallReturn geteuidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target geteuid() handler.
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 dup2Func(SyscallDesc *desc, int num, ThreadContext *tc, int old_tgt_fd, int new_tgt_fd)
Target dup2() handler.
SyscallReturn getcwdFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr buf_ptr, unsigned long size)
Target getcwd() handler.
virtual TheISA::PCState pcState() const =0
virtual RegVal readIntReg(RegIndex reg_idx) const =0
virtual void setMiscRegNoEffect(RegIndex misc_reg, RegVal val)=0
ip6_addr_t addr
Definition: inet.hh:335
virtual PortProxy & getVirtProxy()=0
std::string name()
Definition: syscall_desc.hh:88
Bitfield< 2, 1 > contents
Definition: process.cc:155
virtual Process * getProcessPtr()=0
uint64_t RegVal
Definition: types.hh:168
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
Bitfield< 19 > pc
Definition: misc.hh:807
static SyscallReturn unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target uname() handler.
Definition: process.cc:94
static SyscallReturn archPrctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Definition: process.cc:112
TypedBufferArg is a class template; instances of this template represent typed buffers in target user...
SyscallReturn fallocateFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int tgt_fd, int mode, off_t offset, off_t len)
ThreadContext is the external interface to all thread state for anything outside of the CPU...
SyscallReturn sendtoFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr bufrPtr, size_t bufrLen, int flags, Addr addrPtr, socklen_t addrLen)
SyscallReturn closeFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd)
Target close() handler.
static SyscallDescABI< DefaultSyscallABI > syscallDescs32[]
Definition: process.cc:600
SyscallReturn getegidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getegid() handler.
uint32_t flags
Definition: process.cc:174
SyscallReturn renameFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr oldpath, Addr newpath)
Target rename() handler.
static SyscallReturn setThreadArea32Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
Definition: process.cc:178
SyscallReturn umaskFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target umask() handler.
SyscallReturn pipe2Func(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target pipe() handler.
SyscallReturn munmapFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Target munmap() handler.
SyscallReturn chdirFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname)
Target chdir() handler.
SyscallReturn getuidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Bitfield< 4 > limit_in_pages
Definition: process.cc:157
SyscallReturn getpeernameFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr sockAddrPtr, Addr addrlenPtr)
SyscallReturn unlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname)
Target unlink() handler.
uint64_t base_addr
Definition: process.cc:172
Bitfield< 3 > read_exec_only
Definition: process.cc:156
SyscallReturn exitGroupFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int status)
Target exit_group() handler: terminate simulation. (exit all threads)
uint32_t __padding1
Definition: process.cc:171
SyscallReturn mkdirFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, mode_t mode)
Target mkdir() handler.
SyscallReturn getsocknameFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr addrPtr, Addr lenPtr)
void syscall(ThreadContext *tc, Fault *fault) override
Definition: process.cc:588
SyscallReturn _llseekFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint64_t offset_high, uint32_t offset_low, Addr result_ptr, int whence)
Target _llseek() handler.
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override
Definition: process.cc:1060
SyscallReturn shutdownFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, int how)
Target shutdown() handler.
SyscallReturn recvfromFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr bufrPtr, size_t bufrLen, int flags, Addr addrPtr, Addr addrlenPtr)
SyscallReturn setsockoptFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, int level, int optname, Addr valPtr, socklen_t len)
SyscallReturn readlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, Addr buf_ptr, size_t bufsiz)
Target readlink() handler.
SyscallReturn mknodFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, mode_t mode, dev_t dev)
Target mknod() handler.
virtual RegVal getSyscallArg(ThreadContext *tc, int &i)=0
SyscallReturn rmdirFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname)
SyscallReturn ftruncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, off_t length)
Target ftruncate() handler.
SyscallReturn getppidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getppid() handler.
SyscallReturn brkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr new_brk)
Target brk() handler: set brk address.
static SyscallDescABI< DefaultSyscallABI > syscallDescs64[]
Definition: process.cc:260
SyscallReturn ignoreWarnOnceFunc(SyscallDesc *desc, int num, ThreadContext *tc)
Like above, but only prints a warning once per syscall desc it&#39;s used with.
Definition: syscall_emul.cc:84
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 getgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getgid() handler.
SyscallReturn linkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, Addr new_pathname)
Target link() handler.
SyscallReturn sendmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr msgPtr, int flags)
Addr npc() const
Definition: types.hh:151
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override
Definition: process.cc:950
Bitfield< 6 > useable
Definition: process.cc:159
SyscallReturn listenFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, int backlog)
SyscallReturn getpgrpFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getpgrpFunc() handler.
This class provides the wrapper interface for the system call implementations which are defined in th...
Definition: syscall_desc.hh:69
SyscallReturn gettidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target gettid() handler.
This object is a proxy for a port or other object which implements the functional response protocol...
Definition: port_proxy.hh:82
SyscallReturn truncateFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, off_t length)
Target truncate() handler.
SyscallReturn getsockoptFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, int level, int optname, Addr valPtr, Addr lenPtr)
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override
Definition: process.cc:1086
SyscallReturn lseekFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, uint64_t offs, int whence)
Target lseek() handler.
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:926
SyscallReturn pipeFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target pipe() handler.
virtual RegVal readMiscRegNoEffect(RegIndex misc_reg) const =0
SyscallReturn symlinkFunc(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, Addr new_pathname)
Target symlink() handler.
This file defines objects used to emulate syscalls from the target application on the host machine...
This is exposed globally, independent of the ISA.
Definition: acpi.hh:57
void clone(ThreadContext *old_tc, ThreadContext *new_tc, Process *process, RegVal flags) override
Definition: process.cc:594
SyscallReturn setTidAddressFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, uint64_t tidPtr)
Target set_tid_address() handler.
SyscallReturn connectFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int addrlen)
SyscallReturn setpgidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int pid, int pgid)
Target setpgid() handler.
OpSys getOpSys() const
Definition: object_file.hh:125
SyscallReturn recvmsgFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr msgPtr, int flags)
SyscallReturn truncate64Func(SyscallDesc *desc, int num, ThreadContext *tc, Addr pathname, int64_t length)
Target truncate64() handler.
uint32_t limit
Definition: process.cc:173
SyscallReturn bindFunc(SyscallDesc *desc, int num, ThreadContext *tc, int tgt_fd, Addr buf_ptr, int addrlen)
void write(Addr address, const T &data) const
Write object T to address.
Definition: port_proxy.hh:293
#define warn(...)
Definition: logging.hh:212
BitUnion32(UserDescFlags) Bitfield< 0 > seg_32bit
This class represents the return value from an emulated system call, including any errno setting...
Bitfield< 5 > seg_not_present
Definition: process.cc:158
T bits(T val, int first, int last)
Extract the bitfield from position &#39;first&#39; to &#39;last&#39; (inclusive) from &#39;val&#39; and right justify it...
Definition: bitfield.hh:72
Each instance of a Loader subclass will have a chance to try to load an object file when tryLoaders i...
Definition: process.hh:191
Bitfield< 0 > p
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
SyscallReturn getpidFunc(SyscallDesc *desc, int callnum, ThreadContext *tc)
Target getpid() handler.
SyscallReturn exitFunc(SyscallDesc *desc, int callnum, ThreadContext *tc, int status)
Target exit() handler: terminate current context.
I386LinuxProcess(ProcessParams *params, ObjectFile *objFile)
Constructor.
Definition: process.cc:931
void syscall(ThreadContext *tc, Fault *fault) override
Definition: process.cc:937
SyscallReturn ftruncate64Func(SyscallDesc *desc, int num, ThreadContext *tc)
Target ftruncate64() handler.

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