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

Generated on Wed Sep 30 2020 14:01:59 for gem5 by doxygen 1.8.17