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

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