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

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